UART0 loopback test not working consistently

Hello all,
I’ve been compiling and testing various RoboticsCape example codes on the BBBlue. The distribution I currently have installed is the latest IoT image: bone-debian-9.2-iot-armhf-2017-10-10-4gb.
I have tested rc_uart_loopback on UART0, UART1, UART2, and UART5. Following the instructions in the example code, I shorted the TX and RX pins together on a breadboard and ran the program for each UART. The other three worked normally, however UART0 has been giving me problems.

On testing UART0, one of four outcomes may be encountered:

  • UART0 fails to initialize:

    debian@beaglebone:~/bin/RoboticsCapeInstaller/Robotics_Cape_Installer/examples/rc_uart_loopback$ sudo ./rc_uart_loopback 0

    testing UART bus 0

    cannot set uart0 attributes

    Failed to rc_uart_init0

    Exiting Cleanly

  • UART0 times out:

    debian@beaglebone:~/bin/RoboticsCapeInstaller/Robotics_Cape_Installer/examples/rc_uart_loopback$ sudo ./rc_uart_loopback 0

    testing UART bus 0

    Sending 11 bytes: Hello World
    timeout reached, 0 bytes read

    Exiting Cleanly

  • UART0 reads back various amounts of whitespace:

    debian@beaglebone:~/bin/RoboticsCapeInstaller/Robotics_Cape_Installer/examples/rc_uart_loopback$ sudo ./rc_uart_loopback 0

    testing UART bus 0

    Sending 11 bytes: Hello World
    Received 11 bytes:

    Exiting Cleanly

  • UART0 works properly (occasionally):

    debian@beaglebone:~/bin/RoboticsCapeInstaller/Robotics_Cape_Installer/examples/rc_uart_loopback$ sudo ./rc_uart_loopback 0

    testing UART bus 0

    Sending 11 bytes: Hello World
    Received 11 bytes: Hello World

    Exiting Cleanly

I used the same JST-SH-4 connector wired to the breadboard to test UART1 and UART5 and encountered no issues with those ports, so I don’t believe it’s my circuit.
The source code implies that UART0 is on a debug header. Could it be periodically in use by something in the background? Where can I find more information about the “debug header?”


  • rc_uart_loopback.c

  • This is a test to check read and write operation of UART buses.

  • For this example to work, connect the RX and TX wires of one of the included

  • 4-pin JST-SH pigtails and plug into the UART1 or UART5 headers. You may also

  • elect to test UART0 on the debug header or UART2 on the GPS header.

  • The test strings this programs transmits will then loopback to the RX channel.

*******************************************************************************/

https://github.com/StrawsonDesign/Robotics_Cape_Installer/blob/master/examples/rc_uart_loopback/rc_uart_loopback.c

Thanks,
Robert