Raspberry Pi UART serial wont work

Martin Law picture Martin Law · Dec 25, 2013 · Viewed 45.9k times · Source

I am trying to send/receive data over serial connection (GPIO UART pins) between a Raspberry Pi (B model, raspian wheezy) and an STM32F4 board.

To setup the serial port, i followed all the stepts found in several tutorials like: http://elinux.org/RPi_Serial_Connection#Preventing_Linux_using_the_serial_port

When failing to get a connection to the STM32F4 board, i read that you can test the serial port locally on the pi if you just connect the TX, RX pins off the pi to eachother and it should just repeat the entered data in minicom.

sadly this does not work either.

The settings for ttyAMA0 in files 'cmdline' and 'inittab' are ok. (like described in many tutorials)

and allso tried auto configuration scrips from https://github.com/lurch/rpi-serial-console

Connecting RX to the TX pin on rpi directly does not give any output in minicom. I allso tried with a python script that repeats given input. Nothing seems to work, i'm kind of lost here.

Minicom start command should be correct(tried with different baud rates):

root@raspberrypi:/home/jef# minicom -b 9600 -o -D /dev/ttyAMA0

OPTIONS: I18n
Compiled on Apr 28 2012, 19:24:31.
Port /dev/ttyAMA0

On the bottom of minicom it allways shows status offline:

CTRL-A Z for help |  9600 8N1 | NOR | Minicom 2.6.1  | VT102 |      Offline

When checking available serial ports with python nothinig is swown:

python -m serial.tools.list_ports
no ports found

User is in dailout group so that should not be the issue(tried as root and non root):

root@raspberrypi:/home/jef# id
uid=0(root) gid=0(root) groups=0(root),20(dialout),1001(indiecity)

Verification that serial port is not used by getty anymore:

root@raspberrypi:/home/jef# ps aux | grep getty
root      2809  0.0  0.1   3740   804 tty1     Ss+  10:36   0:00 /sbin/getty --noclear 38400 tty1
root      2810  0.0  0.1   3740   804 tty2     Ss+  10:36   0:00 /sbin/getty 38400 tty2
root      2811  0.0  0.1   3740   804 tty3     Ss+  10:36   0:00 /sbin/getty 38400 tty3
root      2812  0.0  0.1   3740   804 tty4     Ss+  10:36   0:00 /sbin/getty 38400 tty4
root      2813  0.0  0.1   3740   804 tty5     Ss+  10:36   0:00 /sbin/getty 38400 tty5
root      2814  0.0  0.1   3740   804 tty6     Ss+  10:36   0:00 /sbin/getty 38400 tty6
root      3129  0.0  0.1   2012   624 pts/0    S+   11:57   0:00 grep getty

i checked for other apps using ttyAMA0, allso nothing:

root@raspberrypi:/home/jef# ps aux | grep ttyAMA0
root      3125  0.0  0.1   2012   628 pts/0    S+   11:56   0:00 grep ttyAMA0

users has correct rights to access serial port:

root@raspberrypi:/home/jef# ls -l /dev/ttyAMA0
crw-rw---T 1 root dialout 204, 64 Dec 25 11:53 /dev/ttyAMA0

Is there anything i missed? I read about 20 different tutorials and blogs on how to setup the serial port and i can't fond what causes this. Could you give me some advice i could look for please.

Answer

GDubYa picture GDubYa · Jan 3, 2014

I just went through something similar today. I had to set minicom to disable hardware control and the looping worked for me, as well as cross connecting 2 Raspis together over UARTs.

Also, I use 115200 buad rate on my TTYAMA0 connection string minicom -b 115200 -o -D /dev/ttyAMA0

Alt A

Z

O

Serial Port Setup [enter]

F toggles hardware flow control off

*Save those settings and anything you type should show up on the screen, but is actually being transmitted via uarts.

My minicom footer looks like this as well (just diff baud rate, but shows offline also but works)

CTRL-A Z for help |115200 8N1 | NOR | Minicom 2.5 | VT102 | Offline

Good Luck!