Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Convert RS232 to UART and vice versa (discrete)

Status
Not open for further replies.

neazoi

Advanced Member level 6
Joined
Jan 5, 2008
Messages
4,118
Helped
13
Reputation
26
Reaction score
15
Trophy points
1,318
Location
Greece
Activity points
36,907
I have this circuit **broken link removed** and I need to make it communicate with this **broken link removed**
But the modem IC uses UART 0/5v. I do not want to use the second UARD serial of the MCU so I am limited to the RS232.

Is there a simple discrete way to make these two devices communicate?

For data that is sent from the MCU to the modem, I believe a simple diode will suffice, to eliminate (making them zero) the negative pulses.
But for data received from the modem to the MCU, zero needs to be converted to -V (or is it one?)
So some kind of charge pump is needed.
 

For data that is sent from the MCU to the modem, I believe a simple diode will suffice, to eliminate (making them zero) the negative pulses.
But for data received from the modem to the MCU, zero needs to be converted to -V (or is it one?)
No, RS232 signal is inverted with respect to UART logic level. UART logic has idle state high while RS232 has idle state low.
 

Technically FvM is correct (isn't he always!) but you might be able to bend the rules a little.

For conversion of RS232 to TTL, add a resistor (~1K) in series with the data and on the receiver end of it connect a diode with anode end to ground. This will conduct when the RS232 signal is negative. Also connect it to the base of an NPN transistor, emitter to ground and collector pulled up 5V. It isn't true RS232 conversion but it will give voltage translation and inversion.

For the TTL to RS232 you do the opposite and omit the diode. The signal goes to the base through a resistor, the emitter is grounded and the collector is pulled up to +12V. It may work because many RS232 receivers ignore the negative voltage anyway so producing a signal between 0V and +12V will often fool them into working.

You could of course simply cross-link TX to RX at TTL levels and not use RS232 at all. That would also make the components around D4 redundant as no negative supply would be needed.

Brian.
 

Technically FvM is correct (isn't he always!) but you might be able to bend the rules a little.

For conversion of RS232 to TTL, add a resistor (~1K) in series with the data and on the receiver end of it connect a diode with anode end to ground. This will conduct when the RS232 signal is negative. Also connect it to the base of an NPN transistor, emitter to ground and collector pulled up 5V. It isn't true RS232 conversion but it will give voltage translation and inversion.

For the TTL to RS232 you do the opposite and omit the diode. The signal goes to the base through a resistor, the emitter is grounded and the collector is pulled up to +12V. It may work because many RS232 receivers ignore the negative voltage anyway so producing a signal between 0V and +12V will often fool them into working.

You could of course simply cross-link TX to RX at TTL levels and not use RS232 at all. That would also make the components around D4 redundant as no negative supply would be needed.

Brian.


I will draw a small schematic just to make sure I have understood that correctly. In the mean time, I am thinking that the MCU outputs a TTL actually isn't it? So can I just bypass the negative charge pump?
 

In the mean time, I am thinking that the MCU outputs a TTL actually isn't it? So can I just bypass the negative charge pump?
More accurately you can omit the charge pump, all it does is generate the negative voltage to more closely follow RS232 voltage levels.
Bear in mind that in a standard RS232 link, the signal polarity is inverted twice (hence the two transistors), once to make RS232 from TTL and again to reverse it back again. The net effect is no inversion so you can directly connect the two devices with no interface between them. RS232 is normally used when longer distances are needed but the +12/-12 Voltages date back to the days when it was directly powering relays and teleprinter solenoids. For short distance TTL to TTL it isn't needed and a simple wired connection will work just as well.

Brian.
 
  • Like
Reactions: neazoi

    neazoi

    Points: 2
    Helpful Answer Positive Rating
More accurately you can omit the charge pump, all it does is generate the negative voltage to more closely follow RS232 voltage levels.
Bear in mind that in a standard RS232 link, the signal polarity is inverted twice (hence the two transistors), once to make RS232 from TTL and again to reverse it back again. The net effect is no inversion so you can directly connect the two devices with no interface between them. RS232 is normally used when longer distances are needed but the +12/-12 Voltages date back to the days when it was directly powering relays and teleprinter solenoids. For short distance TTL to TTL it isn't needed and a simple wired connection will work just as well.

Brian.

Well I finally took the signals directly from the chip pins **broken link removed** and it worked!
The author of the firmware has included an RS232/TTL setting in the firmware, which I do not know what it does but it enables TTL when set accordingly. If set to RS232 instead and the signals are taken directly from the chip pins instead of the DSUB9 connector then garbage is sent and received.

So I think this works ok!
 

Hi,

What's the behind the idea to build this with discrete parts?
The usual converter ICs are simple, cheap and most of all they work reliably, even for high baud rates. They usually include ESD protection and create output voltage levels according RS232 standard. A lso the input voltage thresholds are according RS232.
If you include all this in your circuit, then it may become complex.

There are even completely assembled very small and cheap modules availabke at ebay and many other places in the internet.

Klaus
 

Hi,

What's the behind the idea to build this with discrete parts?
The usual converter ICs are simple, cheap and most of all they work reliably, even for high baud rates. They usually include ESD protection and create output voltage levels according RS232 standard. A lso the input voltage thresholds are according RS232.
If you include all this in your circuit, then it may become complex.

There are even completely assembled very small and cheap modules availabke at ebay and many other places in the internet.

Klaus

There may be several reasons, and of different consideration for each hobbyist.
Cost, availability and obsolescence may be some, but to my view availability is a main issue. You just may not happen to have this IC on junkbox when you want it, having to wait for several days to order it.
I do not like when this happens.
A few NPNs are more likely to be found in everyone's junkbox.

But as said I was lucky to not need any of them finally.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top