Unreliable serial communcation via the UART TX/RX GPIO Pins

It’s been over three weeks and I’m still unable to make a simple and stable Serial communication via UART TX/RX work between an Arduino and the Jetson Developer Kits (Xavier NX or the Nano).

Initially, I managed to make things work on the Jetson Xavier NX, on port /dev/ttyTHS0 via GPIO pins 8,10.
After disabling nvgetty everything seemed to work well.

I then tried to replicate the same setup on the Jetson Nano (as we will need multiple boards for our research) but the serial data is scrambled / corrupt (still trying to solve it here).

A few days ago (Monday, Oct. 26th) things stopped working on the Xavier NX as well.
I’m still getting inbound data from the Arduino, but unable to send anything to the Arduino.
So my guess is something is wrong with the TX pin (GPIO pin 8)?
I don’t think its a hardware issue as I tested it with a new kit which I got today.

  • As mentioned the same setup still (almost) works on the Jetson Nano, the data goes both ways but is scrambled.
  • When connecting the Arduino via USB the serial communication works well on both kits.
  • Similar setup works perfectly on a Raspberry Pi.

Here are images of my setup:


↑↑↑ Jetson Xavier NX Kit Connected to an Arduino - Only the RX on the Jetson works (TX stopped working on Monday Oct. 26th)


↑↑↑ Jetson Nano Kit Connected to an Arduino - Both TX and RX work but the data is scrambled as described here


↑↑↑ The Same setup with a RaspberryPi - works very well

I’m using “Minicom” and the “Arduino IDE Serial Monitor” to test the communication on all platforms.

Seems like using a USB cable is the only reliable option for serial communication with the Jetson boards at the moment.

It probably shouldn’t matter with short wires, but just to be cautious you might try to use twisted pair, and with TX and RX the same length. I’ve had good luck with using ethernet cable for this (it even has a shield). Not likely the problem, but it would eliminate noise.

Thanks, @linuxdev!
The Arduino setup is just for a “sanity check”, I’m actually trying to talk to this board which goes directly on the header pins, so hoping for no wires to be involved in the final setup.

I’m trying to migrate my project from a Raspberry-Pi as I need higher FPS on the Computer Vision part.
But it turned to be surprisingly overcomplicated to work with the UART/Serial comunication on the Jetsons.

This should probably be part of the original thread, rather than splitting it off. I did make a suggestion in that other thread.

Seems like a similar TX pin problem occurs on some of the Jetson Nano Dev Kits as well and being discussed here:

FYI, Nano and NX carriers are the same, but there was an earlier revision, the a02 carrier board, and a newer revision, the b01 revision. Also, eMMC models and SD card models have differences in what is required of the carrier board.

This is how my boards look like. they seem to be slightly different, also when looking at them from the bottom. @linuxdev can you tell which one is the older / newer version?

hello yurikleb,

that’s Nano Rev. B01. (newer versions)
please access download center, you may check Developer Kit User Guides for reference.
thanks

Hey, @JerryChang are both of the above carriers Nano REV B01? for the Xavier and the Nano?
Is there any way to debug and find why would the TX pin (GPIO pin 8) does not work on this board?
And how to fix this?

thanks!

Hi yurikleb,
For me, UART TX/RX on 40-pins are working fine. You do not need any pinmuxing or any other software change to make it work.
I flashed the device and connected UART on TX/RX pins of 40-pin header Nano. After system boots, login prompt shows up on ttyUSB0 as I have connected FTDI chip from UART of 4o-pin Nano to my local PC USB. From minicom of ttyUSB0, I could see data coming fine.
Some logs:
Ubuntu 18.04.4 LTS tegra-ubuntu ttyTHS1

tegra-ubuntu login:
root@tegra-ubuntu:/home/ubuntu# cat /proc/device-tree/compatible
nvidia,p3449-0000-a02+p3448-0000-a02nvidia,jetson-nanonvidia,tegra210root@tegr
root@tegra-ubuntu:/home/ubuntu#
root@tegra-ubuntu:/home/ubuntu# dmesg | less
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.201-tegra (shgarg@sg-system-product-name) (g 0
[ 0.000000] Boot CPU: AArch64 Processor [411fd071]
[ 0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[ 0.000000] OF: fdt: - 80000000 , 7ee00000
[ 0.000000] OF: fdt: - 100000000 , 7f200000
[ 0.000000] earlycon: uart8250 at MMIO32 0x0000000070006000 (options ‘’)
[ 0.000000] bootconsole [uart8250] enabled
[ 0.000000] OF: fdt:Reserved memory: failed to reserve memory for node 'fbaB
[ 0.000000] OF: fdt:Reserved memory: failed to reserve memory for node 'fbaB
[ 0.000000] OF: fdt:Reserved memory: failed to reserve memory for node 'fbaB
[ 0.000000] OF: fdt:Reserved memory: failed to reserve memory for node 'fbaB
[ 0.000000] OF: reserved mem: initialized node vpr-carveout, compatible idit
[ 0.000000] OF: reserved mem: initialized node iram-carveout, compatible ivt
root@tegra-ubuntu:/home/ubuntu#

Can you please share your steps in detail once what exactly you have done after flash?
For ex. from which console did you disable getty and then you connected UART on 40-pin? or what exactly are the steps? Also, can you try by not disabling any getty service?

Hey @shgarg

Here are my steps for both the Jetson Nano and the Xavier NX Develper Kits:

  1. Downloaded an SD Image file from here to my local machine (Dell XPS 13, Ubuntu 20.04)
  2. Flashed an SD Card using Balena Etcher
  3. Insert the SD card into the Jetson Dev Kit
  4. Turn on the Dev Kit and go thru the initial Ubuntu OS setup,
  5. Shutdown the Jetson Dev Kit
  6. Connect Pins 6,8,10 on the Jetson to an FTDI chip (jumper on 3v logic)
  7. Connect the FTDI chip to my local machine via USB cable
  8. Open a serial monitor on my local machine, with the following settings; Port: /dev/ttyUSB0 Baud: 115200
  9. Turn on the Jetson Dev Kit
  10. As the Jetson system boots up I see coherent data in the Serial Monitor on my local machine and able to communicate with the Jetson Dev kit (both the Nano and the Xavier NX). here is a sample data stream:
Ubuntu 18.04.5 LTS attune-jn ttyTHS1

attune-jn login: attune

Password: 
Last login: 木 11月  5 11:07:09 JST 2020 on ttyTHS1
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.9.140-tegra aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

59 packages can be updated.
0 updates are security updates.

attune@attune-jn:~$ ls
Desktop    Downloads         Music     Public     Videos
Documents  examples.desktop  Pictures  Templates
attune@attune-jn:~$ dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.140-tegra (buildbrain@mobile-u64-4263) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SMP PREEMPT Fri Oct 16 12:32:46 PDT 2020
[    0.000000] Boot CPU: AArch64 Processor [411fd071]
[    0.000000] OF: fdt:memory scan node memory@80000000, reg size 48,
[    0.000000] OF: fdt: - 80000000 ,  7ee00000
[    0.000000] OF: fdt: - 100000000 ,  7f200000
[    0.000000] Found tegra_fbmem: 00800000@92cb4000
...
  1. All is going well so far :)
  2. Shut Down the Jetson
  3. Connect an Arduino to the Jetson via 3 Jumper cables - GND, TX, RX
  4. Turn on the Jetson
  5. Install minicom (via apt-get)
  6. Run minicom: sudo minicom -s
  7. Update Serial Port Settings to:
    On the Nano: Serial Device: /dev/ttyTHS1, Baud: 115200 8N1, HW+SW Flow Controll: off
    On the Xavier NX: Serial Device: /dev/ttyTHS0, Baud: 115200 8N1, HW+SW Flow Controll: off
  8. Save minicom setup as dfl
  9. Exit to minicom monitor screen
  10. Connect power to the Arduino (I tried powering the Arduino via external Power Supply, via USB and via the Jetson 5V GPIO pins )
  11. On the Nano: Corrupt data comes in from the Arduino, when sending data the reposne comes back also scrambled.
    Example: ‚I receivZCCáI receivëë5¹½nI receiv/ÝI receiv ¤Hø
    On the Xavier the data comes in correct but I’m unable to send anything to the Arduino.

The Arduino is running a simple serial test code which prints “hello!” when the arduino boots, and echos back any data sent to the Arduino.
When the Arduino is connected via usb (/dev/ttyACM0) to the Jetson, communication works very well.
Here is a sample output:

Welcome to minicom 2.7.1

OPTIONS: I18n                                                                
Compiled on Aug 13 2017, 15:25:34.                                           
Port /dev/ttyACM0, 12:21:45                                                  
                                                                             
Press CTRL-A Z for help on special keys                                      
                                                                             
hello!!                                                                      
I received: hi                                                               
I received: works!                                                           
I received: yay!       

This time I did not disable or change any of the default OS nvgetty service settings

This setup works well on the Raspberry Pi as described in the OP (following those instructions).

Hi yurikleb,
Can you make sure your arduino voltage of TX/RX should be at 3.3V since 40-pin UART pins run at 3.3V and have a common ground connection.
Other than that, Can you also try connecting UART instead on 40-pin connector, connect on J44 Pin 4 and 5 to see if issue is with 40-pin. Although I do not think issue with 40-pin since 40-pin UART worked when you connected FTDI on local machine and getting successful data. It may be some incompatibility of UART with Arduino.
Let me know the results.

Hey @shgarg I cant find the J44 pins on my boards.
See the image of both of them above:

I’m sure everything is correct on the Arduino side, as it works with a Raspberry Pi
All UARTs on the Raspberry Pi are also 3.3V only, as described here

I am sure you have checked this link, if not , please check it once Jetson Nano - UART - JetsonHacks

Hi yurikleb,
I think it is below the CVM, you have kept Nano in some brown box so it’s not visible. It’s below the board. But I still want you to have a level shifter and check with 3.3V level to rule out that voltage level is not the issue.
Let me know.

Thanks,
Shubhi

@shgarg I think I’m using the Jetson Nano B01 which doesn’t seem to have the J44 Pins.
As described on this page the J44 was removed from the B01.
The Jetson-Hacks tutorial shows the older A02 Board.

I do have the “Button Header” (J50) Pins which have pins 3 and 4 labelled as TX/RX.

Should I try those? Which Port are they mapped to? on the Nano and the Xavier?

Also, where should I place a level shifter?

Hi,
Let’s talk only about Nano so Yes B01 has button header J50 having UART1 means it should show ttyTHS0.
But first try out level shifter on arduino pins to bring out 3.3V on TX/RX pins of arduino, keep UART connected on 40-pin for this experiment and have a common ground connection. Disable nvgetty to not have a serial console on ttyTHS1 as you have done before. Now check the data on ttyTHS1 and let me know. If it still does not work, try out with ttyTHS0.

Hey @shgarg,

I just did an experiment with an Adafruit Feather which is using 3.3v logic. I uploaded the same “Serial Test” code I used on the Arduino, connected to the 40 GPIO pins on the Jetson and it seems to work fine.

Data goes both ways - from the Adafruit Feather to the Jetson and back uninterrupted.

I tested with nvgetty on and off. When nvgety was enabled it was interfering with the communication as it was thinking the data coming from the Feather is the console login credentials. After a few seconds it printed a “too many password attempts” error. From that moment on, the communication with the board was smooth. So I guess nvgetty should be disabled when working with the TX/RX on the 40 GPIO pins. Otherwise, the first few seconds of the communication are interrupted by the console.

I will get the level shifters tomorrow and will test with the Arduino as well.

I did some tests with an Arduino and Logic Level Shifters Today.
The results are a bit random.

I the data from the Arduino to the Jetson is sometimes stable, and sometimes becomes scrambled - depends on the setup. I tried powering the Arduino from an external power supply, from the Jetson USB port and from the Jetson GPIO 5v pins.

I was unable to send a coherent data stream from the Jetson to Arduino. Sometimes sometimes I get a stable stream of data incoming from the Arduino, sometimes it gets scrambled, When I send something from the Jetson it seems like it gets scrambled and sometimes not being sent at all. I also tried using two separate level shifter boards for the TX and RX, unsuccessfully.

I checked with an oscilloscope to confrim the signal from the arduino TX pin is being shiftetd from 5v to 3.3v.
Here is aphoto of the osciloscope screen with the probe connected to the LV side of the shifter:

However, I was not able to find a stable setup in which the data goes both ways uninterrupted.
Here is a photo of one of my attempts:

To confirm I did not damage anything on the Jetson board, I checked again with Adafruit Feather Board and the communication still works well both ways.