Android Things UART 未接收数据 (RPi3) [英] Android Things UART not receiving data (RPi3)

查看:89
本文介绍了Android Things UART 未接收数据 (RPi3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行 Android Things 的 Raspberry Pi 3,我正在尝试编写一个使用 UART 串​​行的应用程序.我使用 Android Things 文档中的示例代码发送数据,它运行良好,但是 应该接收数据的代码返回空字节.

<块引用>

while ((count = uart.read(buffer, buffer.length)) > 0) {Log.d(TAG, "Read " + count + " bytes fromperipheral");}

当 UART 缓冲区获取一些数据时有一个中断,并触发调用读取函数,但读取缓冲区只返回零.实际上根本没有进入循环.

我使用带有 5/3.3V 电平转换器的 5V FTDI 电缆从 Raspberry 发送和接收数据.

我该如何解决这个问题?

解决方案

Raspberry pi 3 有一些 uart 问题,请查看以下答案:

I have a Raspberry Pi 3 with Android Things running on it, and I'm trying to write an application that makes use of UART serial. I used the sample code in Android Things documentation for sending data, and it worked perfectly, but the code supposed to receive data returns empty bytes.

while ((count = uart.read(buffer, buffer.length)) > 0) {
    Log.d(TAG, "Read " + count + " bytes from peripheral");
}

There's an interrupt for when the UART buffer gets some data in, and that gets triggered calling the reading function, but reading the buffer returns nothing but zeros. In fact the loop isn't even entered at all.

I'm using a 5V FTDI Cable with a 5/3.3V Level shifter to send and receive data from the Raspberry.

How can I fix this?

解决方案

Raspberry pi 3 has some issue with uart, check these answers:

这篇关于Android Things UART 未接收数据 (RPi3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆