Can someone tell me the steps what I need to do tu get a serial communication to work?
I have a raspberry pi 3 model b rev 1.1 with Ubuntu Server 20.04. I need to communicate with a sensor via serial communication. I tried a lot of stuff found on the internet but cannot get it to work with a simple loopback setup.
What I tried so far:
- I connected UART pins (8 and 10)
- removed "console=/dev/ttyAMA0,115200" from cmdline.txt
- added "dtoverlay=pi3-disable-bt" to /boot/config.txt
- also tried "dtoverlay=disable-bt"
- and "pi3-miniuart-bt"
- and "enable_uart=1"
- entered "sudo systemctl disable hciuart", "sudo systemctl stop serial-getty@ttyAMA0.service", "sudo systemctl disable serial-getty@ttyAMA0.service"
then tried with "minicom -D /dev/ttyAMA0", nothing happens, also tried python scripts, writing seems to work but reading just gives a timeout.
Anybody has an idea?
Kind regards
Edit 1:
I tried again with Raspberry Pi OS 64-bit, here are my steps:
- sudo apt update && sudo apt upgrade -y
- sudo raspi-config -> serial port -> disable login shell |enable serial port hardware
- reboot
- sudo apt install python3-pip
- pip3 install pyserial
- add "dtoverlay=disable-bt" to /boot/config.txt to disable bluetooth
- test with small python script (from here: Rpi Python Serial Test Program)
this is the output:
Begin serialPortLoopBack() [Remember to connect Tx to Rx!] , ...
bytes written = b'AT\r\n'
bytes read = b''
End serialPortLoopBack(), ...
It doesn't read anything. Pins 8 and 10 are connected via cable. I changed the cable and both pins have something about 3-3.3V.
lrwxrwxrwx 1 root root 7 Aug 13 14:33 /dev/serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Aug 13 14:33 /dev/serial1 -> ttyS0
the groups where I am in:
adm dialout cdrom sudo audio video plugdev games users input render netdev gpio i2c spi