1
\$\begingroup\$

I have an RPi and a freescale FRDM-KL25z controller which will talk over serial protocol. I'm using the pyserial library on the pi:

import serial
ser = serial.Serial('/dev/ttyAMA0', 9600)
ser.write('hi FRDM')

and using the serial protocol from the mbed library will generate interrupts to process the data from the Pi.

https://developer.mbed.org/users/mbed_official/code/mbed/docs/4fc01daae5a5/classmbed_1_1SerialBase.html#ae67fb9b5a2ee2f4e98a39cdab10ed090

My question is, having two devices which talk over the same protocol at the same potential and in close proximity, do I need a logic level converter or some form of UART chip?

I would think not, but I am aware that RS232 is a +-12V protocol so would just like to ensure that this assumption is correct.

\$\endgroup\$
3
  • \$\begingroup\$ If you're using /dev/ttyACM0 then you're using CDC/ACM not RS232. \$\endgroup\$ – Majenko Jan 1 '15 at 16:51
  • \$\begingroup\$ does that mean this code uses one of the USB ports? I plan to use the GPIO pins 8 and 10. \$\endgroup\$ – Mark Corrigan Jan 1 '15 at 16:53
  • \$\begingroup\$ Yes, that code is using USB. For the hardware UART you would use /dev/ttyAMA0 instead. \$\endgroup\$ – Majenko Jan 1 '15 at 16:58
4
\$\begingroup\$

If both share the same logic levels (0V-3.3V) and the same ground it shouldn't be a problem. But then you aren't using RS232, just UART. The Serial bridge on the Arduinos works the same way. The FTDI chip uses 0V-5V and the ATmega uses 0V-5V.

\$\endgroup\$
4
  • \$\begingroup\$ You hit the problem on the head. If one device is using CMOS logic levels (3.3V), and the other is using TTL logic levels (5V), the logic thresholds are different. A logic high is > ~60% of the working voltage (2V for 3.3V logic and 3V for 5V logic). To operate properly he needs a level shifter on either side such as a MAX3232, or a buffer that is tolerant of either logic family. \$\endgroup\$ – cowboydan Jan 1 '15 at 22:27
  • \$\begingroup\$ @cowboydan Are you referring to me by 'he'? Both devices are 3.3V so as I believe David has said I don't think I need any level shifting.. \$\endgroup\$ – Mark Corrigan Jan 1 '15 at 23:12
  • \$\begingroup\$ @cowboydan, in a word, NO! A charge pump device like a max3232 is an absurd suggestion for 3.3-5v translation. And don't make assumptions of threshold voltage without checking data sheets - some 5v devices have a lower VIH than some 3.3v devices. \$\endgroup\$ – Chris Stratton Jan 1 '15 at 23:56
  • \$\begingroup\$ @ChrisStratton - quite right. After re-reading my comment the MAX3232 doesn't seem to make sense here. \$\endgroup\$ – cowboydan Jan 2 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.