myso
Posts: 4
Joined: Tue Mar 29, 2016 10:35 am

Solved: Serial Console UART + MAX3232

Tue Mar 29, 2016 10:46 am

Dear all,

I'd like to ask you for a little help here. I'm running FreeBSD 10.2 on a headless homeserver (ASRock Q1900-ITX MB with Intel J1900 CPU).

I'm trying to build a Remote Access Card using a Raspberry Pi, which should act as a terminal server enabling me to connect to the homeserver using serial console in case the network adapter is down or if I need to debug the boot process.

The RPi GPIO 3v3, GND, txd and rxd pins are connected to this module http://www.aliexpress.com/item/RS232-to ... 68742.html and then directly to a COM port bracket on the server.

In my lab environment I have tested the RPi connection with baud 115200 to a Mikrotik RouterBoard RB433AH successfully.

The problem is when I connect the RPi to the FreeBSD server, it seems like there are some characters beeing sent out of the serial port, which do interrupt the booting process several times (first is the BootLoader menu, I have to disconnect the serial connection and use a keyboard physically attached to the server to select the correct menu item and continue the boot process), then later during the boot process it hangs, until I disconnect the serial connection physically again.

Once I connect the serial port to a running system and open Minicom, I can see the login prompt but it's impossible to login because the user and password are filled with a lot of random characters automatically. Every key press on my end generates a new set of weird characters.

Let me remind that I checked the baudrate, parity and terminal type to match between FreeBSD and my Raspbian configuration, I tried different combinations but didn't manage to find a working one.

Nothing like this happens with the USB/Serial adapter, which works like expected (the interconnection is done via a NULL Modem cable).:

Code: Select all

[404179.375842] usb 1-1.3: new full-speed USB device number 5 using dwc_otg
[404179.478210] usb 1-1.3: New USB device found, idVendor=067b, idProduct=2303
[404179.478249] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[404179.539139] usbcore: registered new interface driver usbserial
[404179.539316] usbcore: registered new interface driver usbserial_generic
[404179.539474] usbserial: USB Serial support registered for generic
[404179.543708] usbcore: registered new interface driver pl2303
[404179.543886] usbserial: USB Serial support registered for pl2303
[404179.544029] pl2303 1-1.3:1.0: pl2303 converter detected
[404179.571090] usb 1-1.3: pl2303 converter now attached to ttyUSB0
root@raspberrypi:~# stty -a < /dev/ttyUSB0
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel
-iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
I doublechecked that the raspbian has turned off sending kernel messages to /dev/ttyAMA0 (used raspi-config to turn the console off).

Strange thing is, that if connecting the RPi to a router (Mikrotik RB433AH), everything works as expected out-of-the-box.

Any ideas?

Many thanks

Michael
Last edited by myso on Wed Mar 30, 2016 10:29 am, edited 1 time in total.

myso
Posts: 4
Joined: Tue Mar 29, 2016 10:35 am

Re: Serial Console UART + MAX3232

Wed Mar 30, 2016 10:29 am

Guys from the FreeBSD forums https://forums.freebsd.org/threads/55621/ helped me get on the correct troubleshooting track and I managed to find a solution:

I tried switching the RS232-to-TTL converter VCC to the 5V branch of RPi GPIO instead of 3.3V (with confidence, because the datasheet of MAX3232 chip claims it can take anything between 3V3 and 5V as input) and it started working!

giro516
Posts: 1
Joined: Fri Apr 29, 2016 2:28 pm

Re: Solved: Serial Console UART + MAX3232

Fri Apr 29, 2016 2:34 pm

I have a raspberry 3 and i try to set "parenb" in tty0 but i've error.. "invalid argument"..from terminal i write sudo "stty -F /dev/tty0 38400 parenb cs8" .. also if i set uart /dev/tty0 from c++ program the setting of parity has not effect!! Please help me. Thank.

myso
Posts: 4
Joined: Tue Mar 29, 2016 10:35 am

Re: Solved: Serial Console UART + MAX3232

Fri Apr 29, 2016 9:31 pm

The uart device broken out from GPIO is addressed as

Code: Select all

/dev/ttyS0
on RPi 3. Have you tried that?

dirk_b
Posts: 1
Joined: Sat Nov 18, 2017 4:54 am

Re: Solved: Serial Console UART + MAX3232

Sat Nov 18, 2017 5:09 am

I'm having the same problem as giro516 - in minicom I can set parity as I like and everything works.

When using stty or trying to set the parity from my own code it doesn't work. "stty -F /dev/ttyS0 9600 parenb" gives a message like invalid argument. With -parenb no error and it works. Anyone having any idea?

Return to “Troubleshooting”