Using the python module "pyserial’ to do serial communication between my PC with JetsonNano. In Nvidia Linux system, i write my python code:
ser = serial.Serial('/dev/ttyTHS1')
by the way, I use TTL in the J41 pins 6,8,10.So i want to connect the port ttyTHS1.
The wrong Message is:
serial.serialutil.SerialException:[Errno 13] Could not openport /dev/ttyTHS1 [Errno 13] Permission denied: '/dev/ttyTHS1'
Why I can’t use this port?
I Checked my TTL connection is right.
So, can you help me to solve this?
If the port is not already being used, then you can add your user to that group and it should work. If you run “ls -l /dev/ttyTHS1” an unused tty device will show owner/group of “root/dialout” (if the group is “tty”, then someone is using this as a terminal).
If your user name is “ubuntu”, then this would add “ubuntu” to the group “dialout”:
sudo usermod -aG dialout ubuntu
If the group is not dialout, then you’d have to first stop whatever is using the port, and then do the same addition to “dialout” (once someone else does not own the port it will revert to the original group once rebooted).
Thanks, linuxdev. I’ve solved my problem. On the hardware level, my TTL RXD was incorrectly connected to the JX’s RXD interface. On the system, when i used command
I find that there is not dialog. so I used command as you say:
sudo usermod -aG dialout
but there was not dialog too.
I searched it on github and then found that someone met this problem. After Running command as follow, i solved my problem:
sudo apt-get update
sudo apt-get upgrade
Well…Finally, I solved this anyway.hah
Thanks again for your suggestion