-
Notifications
You must be signed in to change notification settings - Fork 10
520 termios.error: (22, 'Invalid argument')
Phil edited this page Nov 10, 2024
·
7 revisions
The error most likely appears with Raspi 3 or 4 when ttyS0 gets opend more than once a boot/life time. Then the even parity setting causes trouble (see also here).
Solution is to use ttyAMA0 instead of ttyS0. Problem is that ttyAMA0 by default is bounded to BT, so you need to 'free' it (taken from the thread):
-
sudo nano /boot/config.txt
or with later OS'ssudo nano /boot/firmware/config.txt
- add
dtoverlay=disable-bt
to the bottom and save (this way the uart used for bluethooth is free and can be used for serial [at least that's my understanding]) sudo reboot now
On my Pi4 w. Debian GNU/Linux 12 (bookworm) i had to do:
sudo nano /boot/firmware/config.txt
- add
dtoverlay=pi3-miniuart-bt
in the general section sudo reboot now
after that ttyAMA0 was available for my usage. Don't ask me where I got this from (probably googel), but for me it works.
perhaps in some cases you need to use dtoverlay=miniuart-bt
. fu.. frequent changes of the system....
check for ttyAMA0 using ls /dev/tty*
evtl with sudo