Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

  • Author

Strangely, I entered "sudo chmod 777 /dev/ttyS1"

and "python3 -m serial.tools.miniterm /dev/ttyS1 230400"

worked

 

This is something that other apps using serial need, like ROS

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.