Issues with uart gpio pins on Jetson AGX devkit

I’m trying to use gpio uart pins on jetson AGX devkit (JetPack 4.4.1).
All operations i made in python3 with pyserial.
I tried 2 schemas:

  1. I connected pins with rs232 (6(GND) - gnd, 8(TX) - RX, 10(RX) - TX), then connected rs232 to usb serial adapter(rs232-usb) and connect in to usb on same jetson. So i got 2 ports: /dev/ttyUSB0 and /dev/ttyTHS0. I can send data from usb0 to ths0 and backwards. But data collected on output always differ from input. For example, if i send b’k’ it returns ‘J’, b’a’ - ‘0’, etc.
    Both ports were opened with same parameters.(115200 8N1)
  2. I tried to connect can bus controller, which sends string ‘S096300 C0165010.000 E0012143.0 R077.0 H1200 J060 ZCA94 \r\n’, but as output i got in hex “00 00 00 00 00 00 00 56 67 66 b3 ae f6 f6 cb 56 f6 d6 f6 36 ed f6 f6 f6 ab 7d fb eb b6 d6 76 96 36 ed f6 db f5 16 16 ed f6 7b 75 db fb f6 f6 5b 7d 9b fb f6 5b 95 f5 fb 2b eb”. Can controller works fine when connected via usb serial.
    Port params were set as mentioned in controller’s documentation.(9600 8N1).
  • Is your RS232 a 3.3V TTL logic level? If not, then it is incompatible without level shifters. If voltages were off, then conceivably some data would go through (with a lot being corrupt).
  • Do both sides use the same character encoding? Not really an issue if you are using binary data, but for console text it would matter.
  • Do both sides use speed 115200 8N1?
  • Who owns your “/dev/ttyTHS0”? See “ls -l /dev/ttyTHS0”. If it is not dialout, then you might have a console or other program also running on the port at the same time.
  • What do you see from:
    systemctl status nvgetty.service

Its seems problem is really in voltage level. Can controller tx voltage is 5v, so i’ll try to use resistor to lower voltage.

Yes, you will need level shifters. The UART is incompatible with 5V.

I placed resistor (220 Ohm) on can controller tx - jetson rx connection but nothing changed.
/dev/ttyTHS0 is dialout.
When i connected it via usb serial i opened ports with 115200 8N1. With can controller i set 9600 8N1 to match with controller parameters. In both cases i have ports with same parameters.
I disable nvgetty.service as was said on guide about using uart gpio pins so its inactive(dead).

Unless you can show on an oscilloscope that any TX/RX is 3.3V at the Jetson side I doubt the resistor setup will work. I’d recommend an actual level shifter.