Jump to content

Reading from /dev/ttyS1 works for screen and picocom but not for python serial


robertoj

Recommended Posts

Hello, :)

 

I have a lidar scanner, which I already made it work with a USB-TTL serial adapter... with a decoding python program... it works great

 

However, I tried to use one of the serial ports in the pins of my orange Pi zero... UART1, in pins PG6,PG7... I have strange behavior

 

When I test the serial port with picocom or screen, I see the flow of characters:

 

picocom -b 230400 /dev/ttyS1

screen /dev/ttyS1 230400

 

However, my python program fails to read at the first character. With the python's own miniterm, I get the same error

 

Spoiler

roberto@orangepizero:~$ python3 -m serial.tools.miniterm /dev/ttyS1 230400
--- Miniterm on /dev/ttyS1  230400,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
��␆S��␀�␀��␀��␀��␀��␀��␀�b␀�d�V�    �,␀�␀��␀��␀�b␀�d␀���␋Y���,␀఍\D��,␀�2�_D��Exception in thread rx:

--- exit ---
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/serial/tools/miniterm.py", line 499, in reader
    data = self.serial.read(self.serial.in_waiting or 1)
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 577, in read
    raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
roberto@orangepizero:~$

 

Anybody who is using ttyS1 successfully in Python?

 

THANKS!!

 

Post data: I enabled the ttyS1 with the addition of "uart1" after "usbhost3" inside armbianEnv.txt

I also changed "console=serial" to "console=ttyS0"

I get a few lines of characters, but then serial/serialposix.py exits with the exception

 

Edited by robertoj
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines