JOTAPEEE
Posts: 3
Joined: Thu Sep 12, 2019 8:03 pm

correct use of serial port

Thu Sep 12, 2019 8:25 pm

Hello, for a job I must process data obtained from a kestrel board (https://images.app.goo.gl/hBE8611vrpJFirHF9) on my raspberry pi 3. The communication I am trying to carry out with a db9 rs232 from that kestrel board to the raspberry. The connection I make is GND-> GND, TX-> RX and RX-> TX. Now, although I receive information from the Kestrel board, this data is wrong. At first I thought it was related to BAUDRATE but everything is at 11520 (which should be correct according to the instructions given to me). But I had a question, what is the name of the port that I must open to use the necessary pins? serial0, ttys0 or ttyAMA0. With ttys0 I do not receive anything, instead with serial0 and ttyAMA0 I receive the erroneous data, what I want to reach, what is the difference between serial0 and ttyAMA0? What is the correct name to use?

User avatar
topguy
Posts: 5776
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: correct use of serial port

Fri Sep 13, 2019 11:36 am

If you do a "ln -s /dev/serial0", my guess would be that it is just a link to "ttyAMA0", if that is the case then they are the same device and naming makes no difference..

Which version of Raspbian do you use ?
Have you used raspi-config to change any of the serial-port related settings ?
Also read this: https://www.raspberrypi.org/documentati ... on/uart.md

User avatar
B.Goode
Posts: 8560
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: correct use of serial port

Fri Sep 13, 2019 11:47 am

The communication I am trying to carry out with a db9 rs232 from that kestrel board to the raspberry.


The uart implemented on the GPIO pins of a Raspberry Pi board does NOT use rs232 signal levels.

Already linked in the previous reply, but to emphasise:
both (uarts) are 3.3V devices, which means extra care must be taken when connecting up to an RS232 or other system that utilises different voltage levels. An adapter must be used to convert the voltage levels between the two protocols. Alternatively, 3.3V USB UART adapters can be purchased for very low prices.
Ref: https://www.raspberrypi.org/documentati ... on/uart.md

scotty101
Posts: 3720
Joined: Fri Jun 08, 2012 6:03 pm

Re: correct use of serial port

Fri Sep 13, 2019 11:47 am

Worth pointing out that the TX/RX pins cannot be connected directly to RS-232. RS-232 has a higher voltage than the Pi can handle. You need a converter like a MAX3232 to convert RS232 to 3.3V TTL.

EDIT: B.Goode beat me to it.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
B.Goode
Posts: 8560
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: correct use of serial port

Fri Sep 13, 2019 11:58 am

scotty101 wrote:
Fri Sep 13, 2019 11:47 am
Worth pointing out that the TX/RX pins cannot be connected directly to RS-232. RS-232 has a higher voltage than the Pi can handle. You need a converter like a MAX3232 to convert RS232 to 3.3V TTL.

EDIT: B.Goode beat me to it.

And to expand -

Not only is the absolute magnitude of an rs232 signal possibly greater than gpio can handle, it is also bi-polar, or balanced or nrzi. So one of the two valid signal states has the voltage negative with respect to the ground. That itself is proably hazardous to a gpio pin, and will almost certainly not be 'decoded' correctly.

Maybe the people who wrote the Raspberry Pi documentation had a reason for their warning... it would be a pity to ignore it.

Heater
Posts: 13342
Joined: Tue Jul 17, 2012 3:02 pm

Re: correct use of serial port

Fri Sep 13, 2019 12:17 pm

I presume you mean 115200 baud. Which is a standard baud rate. Not 11520.

JOTAPEEE
Posts: 3
Joined: Thu Sep 12, 2019 8:03 pm

Re: correct use of serial port

Sat Sep 14, 2019 3:35 am

Heater wrote:
Fri Sep 13, 2019 12:17 pm
I presume you mean 115200 baud. Which is a standard baud rate. Not 11520.
Yes, it is what I meant. ;)

JOTAPEEE
Posts: 3
Joined: Thu Sep 12, 2019 8:03 pm

Re: correct use of serial port

Sat Sep 14, 2019 3:37 am

scotty101 wrote:
Fri Sep 13, 2019 11:47 am
Worth pointing out that the TX/RX pins cannot be connected directly to RS-232. RS-232 has a higher voltage than the Pi can handle. You need a converter like a MAX3232 to convert RS232 to 3.3V TTL.

EDIT: B.Goode beat me to it.
I had already worried about that, the output of the kestrel board has a voltage converter that has the db9 on the other side. ;)

User avatar
rin67630
Posts: 540
Joined: Fri Mar 04, 2016 10:15 am

Re: correct use of serial port

Sat Sep 14, 2019 8:26 am

JOTAPEEE wrote:
Sat Sep 14, 2019 3:37 am
I had already worried about that, the output of the kestrel board has a voltage converter that has the db9 on the other side. ;)
You may also hopefully have considered that V24/RS232 has a negative logic, so your voltage converter should invert the signal?

Return to “General discussion”