Read Uart use J41 /dev/ttyTHS1 padding with zero

Hi everyone,
The jetson nano component is quite new to me and I would like your help.
I try to make bridge between Uart to udp, I use in my hardware in jetson nano i connected to j41 in legs 6-gnd, 8-uart tx,10-uart rx.
In the software i use the command sudo chmod 666 /dev/ttyTHS1 to enable write&read from the uart.
In addition i use socat to transmit udp data, I use the command:
socat UDP4-DATAGRAM:192.168.19.120:47017 /dev/ttyO4,b115200,raw,echo=0 &
I open wireshark in my client and i see the data but i have problem the data is padding with zeros and i dont now why.
I use the same command of socat on the hardware beaglebone black and i enable /dev/tty04 and on the beaglebone its work.
someone cant help my why I read from Uart and i see the data padding with zero?

I can’t answer completely, but do realize that “/dev” files are not real files, they are pseudo files generated by running kernel drivers. Use “ls -l /dev/ttyTHS1”, and add your user to that group as a secondary group. If the group is “console”, then it means the port is already taken. Also check “/dev/ttyS1” because “ttyTHS1” and “ttyS1” are the same physical hardware, but different drivers (and don’t use both at once) to make sure nothing is group “console”. Probably the group is “dialout” for everything which is available for use and not already taken as a serial console.

Example, if your user name is “ubuntu”, to add group “dialout” as a supplemental group for ubuntu:
sudo usermod -aG dialout ubuntu

I can’t answer the content related to UDP. Do realize though that since device special files are not regular files, then chmod will not behave as you expect in most cases. It is a bit like writing “electric” on a gasoline powered car and expecting it to now run on electric. Only happens if the car agrees with you that it is electric. When various changes are allowed like this, then those changes use the udev mechanism.

I use the command ls -l /dev/ttyTHS1 and is display me on the screen :
crw-rw------1 root dialout 238, 1 May 5 17:39 /dev/ttyTHS1
how i add my user to that group as a secondary group?

I just can not understand why I read the information from UART the JETSON just adds zeros to the information.
Is it related to incorrect enabling of the dev\THS1 ?

This is listed above:
sudo usermod -aG dialout ubuntu
(then user “ubuntu” becomes a member of “dialout” in addition to whatever groups he/she was already a member of)

Until permissions are corrected there is no way to know more about any issue. Perhaps previous issues would just go away, and things will start working. In the case of things not working as expected, then keep in mind that one serial UART always talks to another serial UART (regardless of whether the UART is part of the USB cable or integrated on a circuit board), and that there are several settings required for things to work correctly. For example, speed, stop bits, parity bits, so on. The two UARTs are not “plug-n-play”, and they have no way to query each other, so it is up to the end user to make sure UARTs at both ends are set to the same values. Among those which might cause odd characteristics even if speed is correct would be the number of stop bits. Something which could affect TX or RX, but not both, is if one end uses a different CTS/RTS flow control. What happens though after your user is a member of group “dialout”?

Nothing special is not working yet. Like I said I see the data in wireshark but it is padding with zeros. I transferred my code to raspburry pi, enabled the UART /dev/ttyS0 and indeed everything works properly which reinforces my claim that I am defining something incorrectly in jetson.

There is no doubt something incorrect, but I suspect it is the serial UART setting. Keep in mind that if number of bits or stop bits are wrong, then the actual data will come out wrong. Also, if you are not looking at the binary value (though wireshark probably is looking at binary value), and instead interpreting characters via a character set, then the data will look wrong when shown as a character. An example is that if one side is UTF-8, and the other is UTF-16, and the 8 significant bits are the same between the two, then you might end up with NULL bytes or other content showing up when translating between UTF-8 and UTF-16 as padding (this is just a contrived example, but I want to emphasize you need to be certain both sides are using the same serial settings).

How can I check if my user currently a member dialout?
maybe I try to run /dev/ttyTHS1 with super user root because ls -l show me that the permission is in root.

dialout” is a group, not an owner. What is the exact output from “ls -l /dev/ttyTHS1”? Owner will be root, but there will be a group next to that, either “dialout” or “console”.

Assuming your user name is “ubuntu”, then you can see if “ubuntu” is showing up in:
grep dialout /etc/group