Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1246

Python • Pi 5 uart1 (ttyAMA1) doesn't receive in python but is fine with minicom/screen

$
0
0
Hi
I have 4 uart ports on my pi 5, enabled in config.txt:

Code:

dtoverlay=uart1-pi5dtoverlay=uart2-pi5dtoverlay=uart3-pi5dtoverlay=uart4-pi5
With a jumper from pin 12 (uart4 tx) to pin 1 (uart1 rx) I can receive on uart1 fine using minicom. The same with screen.
However with python I get little or no data and then get an error:

Code:

serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
My python test is very simple:

Code:

import serial,time,randomser1 = serial.Serial("/dev/ttyAMA1",19200,timeout=0)ser1.close() #without this I get "port is already open"ser1.open()while True:    print(ser1.read().decode())
I seem to be able to use uart2 and uart4 with no problem in python, just uart1 is causing me trouble. Why is minicom fine but python is not?

Statistics: Posted by jimseng — Fri Feb 21, 2025 5:23 pm



Viewing all articles
Browse latest Browse all 1246

Trending Articles