Using UART ttyTHS1 without sudo on Jetson Nano

Hello,

I’m using the Jetson Nano dev kit to read data from a sensor using UART_2 (/dev/ttyTHS1), which are pins 8 and 10 of the J41 header.
I wrote a code in C that works great. However, I have to launch the program using
sudo ./my_code.c
to run the code, otherwise, I get an error saying that the program cannot open ttyTHS1.
That’s not convenient for me as I need this code to run at startup without the need for me to come in and type my password.
When I do cat/dev/ttyTHS1, I get “Permission denied”.
sudo cat/dev/ttyTHS1 works.

I have tried many different things, such as:
sudo usermod -a -G dialout $USER

I have also added the following the /etc/udev/rules.d/50-myusb.rules
KERNEL=="ttyTHS[0-9]*",MODE="0666"

None of them worked. Am I missing something?
Thanks

This thread might help.

Thank you, that solved it!