Search code examples
uartraspberry-pi3android-things

Android Things UART not receiving data (RPi3)


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?


Solution

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