This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
uart ttyS1

I try to use serial port ttyS1, I have change value in extlinux.conf with:

label kernel-4.4
    kernel /zImage
    fdt /rk3288-miniarm.dtb
    append earlyprintk root=/dev/mmcblk0p2 rw init=/sbin/init

In Idle python3 I run this :

import serial

ser = serial.Serial("/dev/ttyS1",9600)


while (2)  :    

    ser.write(b"hello world")


    print("test serial")

and in the Shell I can read this:


<bound method of Serial<id=0xb52278f0, open=True>(port='/dev/ttyS1', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)>

test serial

Traceback (most recent call last):

  File "/home/linaro/Documents/test_serial", line 6, in <module>

    ser.write(b"hello world")

  File "/usr/lib/python3/dist-packages/serial/", line 517, in write

    raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open

Please help me!
I run on tinkerOs!
I set jumper in pin 8 & 10!
And In tinker board configuration uart1: on uart2: off uart3: on uart4:on
all of other communication turning off!
Have you test the port by shorting pin 8 and 10. There should be your input echoed back. That's will give the idea whether the UART is working. Later you should make sure that you got the permission to access that device. So you might try
$ sudo chmod 666 /dev/ttyS1
Light blue words might be a link. Have you try to click on them? Big Grin
thanks for reply,

I shorting pin 8 &10. It's same result (with and without)
I test whit: sudo chmod 666 /dev/ttyS1 and go back to under line.
but I test programme whit debugger:
'importlib._bootstrap.'_get_module_lock(),line 182:
I have test on other version(python2.7) and it run.
That's the limit of some program which is not ported to python 3.7
Light blue words might be a link. Have you try to click on them? Big Grin
Hi Mathelis

I can reproduce your issue.
please follow my steps, you can see the result at console.
linaro@tinkerboard:~$ python
hello world
test serial
hello world

1. make sure "intf:uart4=on" at /boot/hw_intf.conf
2. shorting pin 13 &15
3. try the test code as below:

import time
import serial

ser = serial.Serial('/dev/ttyS4',9600)

while (2)  :
    ser.write(b"hello world")
    print("test serial")
thank you.

Thanks for the script, I can't tell you if it run before,
I test with uart1 and uart4 and it run.
I can see in the shell :hello world
test serial
It's Good,

Forum Jump:

Users browsing this thread: 1 Guest(s)