Unreliable serial communcation via the UART TX/RX GPIO Pins

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.

I decided to skip the Arduino (as its using 5v logic) and get back to the board which I actually need to use in my project with the Jetson.

The Protoneer Raspberry Pi CNC Board.
Based on the documentation and confirmed in this and this posts, it is using 3.3v logic for the TX and RX communication.

I scoped the board behavior on the Raspberry Pi, with which it works perfectly. Data goes both ways and looks good on the scope. Via minicom, I was sending a simple “$$” command which queries the GRBL firmware flashed on the board to echo back the list of all the settings.

Here are some pictures…

My setup with the Pi:

Sample Incoming data from the board (a list of GRBL settings):

Scoping the RX Pin on the Pi, showing incoming data from the board:

Scoping TX pin on the Pi showing outgoing data to the board:

I tried to re-create the same setup on the Jetson Nano:

The data stream in minicom is completley scrambled:

Scoiping The RX Pin of the Jetson for incoming data from the CNC board looks ok:

Scoping the TX pin of the Jetson for outgoing data from the Jetson to the CNC Board looks messy:

What could be causing this?

1 Like

Did you check minicom settings again this time for flow control?

Yup they are both off

Hi yuikleb,

Did you manage to find a solution? I am experiencing the same issue with my Jetson Xavier NX Developer Kit. I can receive serial on pin 10(RX), but am unable to send serial through pin 8(TX). As you mentioned they are on port /dev/ttyTHS0.

If I use a USB-TTL serial adapter on the Xavier, I can both send and receive from the Xavier to my other board with no problem. That would be a shortcut but I need to use GPIO pin for my final system.

Besides direct terminal commands, I also followed this link Jetson Nano - UART - JetsonHacks but either case I could not send serial from GPIO.

Thank you in advance!

@camasmie as mentioned above, I’m having problems with the TX pin on both the Nano and the Xavier Dev Kits.
It seems like the Jeston are very picky. While working well with some boards they refuse to work with others.
I’m also expiriencing problems with the I2C pins. The Jetsons work with some I2C devices while refusing to detect otheres (but that’s a topic for a different thread)

My current solution is similar to yours - wire the TX/RX pins on the board im using via a USB-TTL (FTDI chip) to the Jetson USB port. Very hacky and convoluted but seems to be the only relieble solution for now.

This is my current setup:

I printed an adaprter to fix the USB-TTL board onto the Jetson USB sockets:

All right, thank you for the update. I will just do that for now USB-TTL, to not waste time trying to fix something that should have just worked out of the box.

EDIT

@yurikleb using the USB-TTL caused new problems with buffer stream buffer. So I went back to the GPIO pin example, and it actually worked with my STM32 target hardware over a RS485 bus. Thank you again.

1 Like

I’ve also been having issues with UART comms on a Jetson Nano and a Teensy 4.0, I’ve tried several baud rates (including 115200 8n1) and none of them seem to work reliably. Has anybody found a fix to this solution? I tried modifying the serial-tegra.c kernel driver to add more RX DMA memory, as I was getting overrun errors on dmesg, but that didn’t seem to solve anything.

1 Like

I can confirm the TX pin on the Jetson Nano is unreliable. I have inspected with digital logic analyser, and it shows it regularly misses a bit. When sending a byte it would ‘miss’ or be unable to set one of the last bits. Increasing the buadrate does help reduce this.

It seems like there is a low priority on the UART communication, since I have moved my comms to the USB port and now i have no problems. I unfortunately have to use a USB-to-UART converter to communicate with the other board.

My program which communicate over the UART is written in C, and uses the EPOLL library to check whether the device is ready to send or receive data.

This helped me to get correct data. You need to connect pull down ~10 kOhm resistor from RX and TX (GPIO 8, 10 pins) to the jetson nano’s ground.

4 Likes