hi
I want to access the serial ports on the RockPi-S using pyserial.
Have installed python and pyserial module.
But what device name do I use?
I have tried this to open a serial port in the normal way:
import serial
ser = serial.Serial(“/dev/ttyS0”, 9600)
This brings up an error since it can’t open “/dev/ttyS0”.
I have tried to find the name of the serial ports on the RockPi-S, but have drawn a blank.
This works on other SBCs but I can’t get it to work on the RockPi-S.
What name do I use for the port on the RockPi-S? “/dev/ttyS0” doesn’t work.
I have tried to find the name of the current serial ports, but can’t find anything.
The reason that “/dev/ttyS0” could not be opened with the python pyserial module was that it was owned by root, and root permission would not allow it to be opened by a user rock.
So I used chown to change the ownership of /dev/ttyS0 to rock, and now pyserial can open the port, without bring up an error:
import serial
$ ser = serial.Serial(“/dev/ttyS0”, 9600)
$ ser.is_open
True
But now I have another problem… when I try to write to the port, it hangs:
import serial
$ ser = serial.Serial(“/dev/ttyS0”, 9600)
$ ser.is_open
True
$ ser.write(‘1234’)
After the ser.write(‘1234’), it just hangs.
Again, I have used this simple pyserial module routines on other SBCs without trouble.
Any suggestions?
If anyone has used pyserial with the RockPi-S, please post some sample code.