EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LIN and RS232

Started by Jones December 9, 2006
I have an embedded target I am trying to program (MC9S08DZ60
microcontroller) that has the SCI pins connected to a TJA1020T LIN
transceiver with single-wire output.

My question is, can I connect this single-wire LIN directly to a pin
(or pins) of the RS232 port on the back of an old DOS PC, and if so,
how?  Can anyone provide link(s) to FAQs or tutorials to help me get
started?

Or, are the electrical characteristics different and I need some sort
of hardware adapter between the LIN wire and the RS232 pin (pins)?

I am somewhat familiar with RS232, having written a few comm programs
in C and assembly on a DOS machine years ago.

Thanks.

Jones wrote:
> I have an embedded target I am trying to program (MC9S08DZ60 > microcontroller) that has the SCI pins connected to a TJA1020T LIN > transceiver with single-wire output. > > My question is, can I connect this single-wire LIN directly to a pin > (or pins) of the RS232 port on the back of an old DOS PC, and if so, > how?
LIN: single wire, bidirectional --> half-duplex RS232: two wires, one per direction --> double simplex, effectively equivalent to full duplex Looks like a pretty solid "no" being the answer to that question to me. You'll need a LIN transceiver between the bus and the PC for pretty much the same reasons that led you to put that TJA1020 between the bus and your embedded controller.
Hans-Bernhard Br=F6ker wrote:
> Jones wrote: > > I have an embedded target I am trying to program (MC9S08DZ60 > > microcontroller) that has the SCI pins connected to a TJA1020T LIN > > transceiver with single-wire output. > > > > My question is, can I connect this single-wire LIN directly to a pin > > (or pins) of the RS232 port on the back of an old DOS PC, and if so, > > how? > > LIN: single wire, bidirectional --> half-duplex > > RS232: two wires, one per direction --> double simplex, effectively > equivalent to full duplex > > Looks like a pretty solid "no" being the answer to that question to me.
Thanks Hans. I did a little more digging into it and I think the answer is indeed "No", but it has more to do with electrical characteristics than half/full duplex. LIN signal levels are +12V and ground. RS232 are +5V and -5V wrt ground. That's why you can't just wire the LIN and the RS232 to each other. If the RS232 signal voltages were the same as LIN, I could just tie the RS232 TX and RX together and tie that to the LIN bus, and connect the grounds. Then write half-duplex software for both sides. After all, that's what a LIN transceiver is essentially; a receiver and a transmitter sitting on the same wire (I think?). I don't necessarily need the two devices to speak to each other in LIN-ese. I just need to be able to electrically connect them so I can write very simple software for both sides to get a little dialog going. I'm assuming if I look around enough I'll find a fairly inexpensive LIN-to-RS232 in-line converter for not much money. If anybody has any experience with this and could provide a link to a product they have used successfully, it would be appreciated.
Jones wrote:

> Thanks Hans. I did a little more digging into it and I think the > answer is indeed "No", but it has more to do with electrical > characteristics than half/full duplex. LIN signal levels are +12V > and ground. RS232 are +5V and -5V wrt ground. That's why you can't > just wire the LIN and the RS232 to each other.
I think you are mis-stating the RS232 spec. Specifically, what you need to look at are the outputs of each spec relative to the spec for the detected and allowable inputs for the other. My guess is that there's a fair chance that part may work, at least in practice if not in theory. The more challenging part is figuring out how to tri-state the PC's RS232 transmit line so that it can listen. You could probably do it with some active device (analog FET switch?) controlled by one of the status lines. This shouldn't be hard to squeeze into the connector shell, but wouldn't be all passives. Well, I take that back. There is one more ugly game you could play. Don't use the RS232 transmit line. Instead, bit bang low baud rate serial transmissions through the two control outputs, opposing diodes on each so that one drives the highs and the other the lows. To tristate, drive the signals to reverse bias both diodes.
Jones wrote:
> Hans-Bernhard Br=F6ker wrote: > > Jones wrote: > > > I have an embedded target I am trying to program (MC9S08DZ60 > > > microcontroller) that has the SCI pins connected to a TJA1020T LIN > > > transceiver with single-wire output. > > > > > > My question is, can I connect this single-wire LIN directly to a pin > > > (or pins) of the RS232 port on the back of an old DOS PC, and if so, > > > how? > > > > LIN: single wire, bidirectional --> half-duplex > > > > RS232: two wires, one per direction --> double simplex, effectively > > equivalent to full duplex > > > > Looks like a pretty solid "no" being the answer to that question to me. > > Thanks Hans. I did a little more digging into it and I think the > answer is indeed "No", but it has more to do with electrical > characteristics than half/full duplex. LIN signal levels are +12V > and ground. RS232 are +5V and -5V wrt ground. That's why you can't > just wire the LIN and the RS232 to each other. > > If the RS232 signal voltages were the same as LIN, I could just tie the > RS232 TX and RX together and tie that to the LIN bus, and connect the > grounds. Then write half-duplex software for both sides. After all, > that's what a LIN transceiver is essentially; a receiver and a > transmitter sitting on the same wire (I think?). > > I don't necessarily need the two devices to speak to each other in > LIN-ese. I just need to be able to electrically connect them so I can > write very simple software for both sides to get a little dialog going. > > I'm assuming if I look around enough I'll find a fairly inexpensive > LIN-to-RS232 in-line converter for not much money. If anybody has any > experience with this and could provide a link to a product they have > used successfully, it would be appreciated.
Jones wrote: snip:
>If the RS232 signal voltages were the same as LIN, I could just tie the >RS232 TX and RX together and tie that to the LIN bus, and connect the >grounds. Then write half-duplex software for both sides. After all, >that's what a LIN transceiver is essentially; a receiver and a >transmitter sitting on the same wire (I think?).
Can't grasp your idea;-) how you will actually do that? Anyway if different voltage level is the only hurdule then why don't you add some thing on LIN side for down conversion? (12v -> 5v) ali
On 9 Dec 2006 22:44:06 -0800, cs_posting@hotmail.com wrote:

>The more challenging part is figuring out how to tri-state the PC's >RS232 transmit line so that it can listen. You could probably do it >with some active device (analog FET switch?) controlled by one of the >status lines. This shouldn't be hard to squeeze into the connector >shell, but wouldn't be all passives.
The common (but non-standard) way to allow multiple RS-232 transmitters on the same line is to connect a diode between the Tx pin and the common bus (with anode at the Tx pin). The line is actively driven only to the "0" (space) space, while the internal receiver resistors pulls the line to Mark ("1") state. With long lines, it might be a good idea to run a resistor from the common point to -12 V (e.g. DTR driven inactive) to maintain a stable Mark state. However, I have no idea, what the LIN character structure is, is it even asynchronous (start/stop bit) and are the speeds compatible with what you might find on PCs. Paul
"Jones" <EtherJones@yahoo.com> wrote in message 
news:1165708089.674098.234950@j72g2000cwa.googlegroups.com...
>>
Hans-Bernhard Br&#4294967295;ker wrote:
> Jones wrote: > > I have an embedded target I am trying to program (MC9S08DZ60 > > microcontroller) that has the SCI pins connected to a TJA1020T LIN > > transceiver with single-wire output. > > > > My question is, can I connect this single-wire LIN directly to a pin > > (or pins) of the RS232 port on the back of an old DOS PC, and if so, > > how? > > LIN: single wire, bidirectional --> half-duplex > > RS232: two wires, one per direction --> double simplex, effectively > equivalent to full duplex > > Looks like a pretty solid "no" being the answer to that question to me.
Thanks Hans. I did a little more digging into it and I think the answer is indeed "No", but it has more to do with electrical characteristics than half/full duplex. LIN signal levels are +12V and ground. RS232 are +5V and -5V wrt ground. That's why you can't just wire the LIN and the RS232 to each other. << Er, no. - RS-232 is +/-12V. - RS-485 and RS-422 are 5V/0V. - RS-423 is +/-5V. Whatever: level translation is easy. Steve http://www.fivetrees.com
cs_posting@hotmail.com wrote:
> Jones wrote: > > > Thanks Hans. I did a little more digging into it and I think the > > answer is indeed "No", but it has more to do with electrical > > characteristics than half/full duplex. LIN signal levels are +12V > > and ground. RS232 are +5V and -5V wrt ground. That's why you can't > > just wire the LIN and the RS232 to each other. > > I think you are mis-stating the RS232 spec. Specifically, what you > need to look at are the outputs of each spec relative to the spec for > the detected and allowable inputs for the other.
The RS232 input is expecting to see the voltage go above (+5) and below (-5) ground. The LIN signals are +12V and 0V wrt ground. RS232 will not recognize 0V as a valid "0" or "1". I can't just connect the LIN bus directly to the RS232 input.
> My guess is that > there's a fair chance that part may work, at least in practice if not > in theory.
I don't think so. RS232 will not recognize 0V as a valid logic level.
Steve at fivetrees wrote:
> "Jones" <EtherJones@yahoo.com> wrote in message > news:1165708089.674098.234950@j72g2000cwa.googlegroups.com... > >> > Hans-Bernhard Br=F6ker wrote: > > Jones wrote: > > > I have an embedded target I am trying to program (MC9S08DZ60 > > > microcontroller) that has the SCI pins connected to a TJA1020T LIN > > > transceiver with single-wire output. > > > > > > My question is, can I connect this single-wire LIN directly to a pin > > > (or pins) of the RS232 port on the back of an old DOS PC, and if so, > > > how? > > > > LIN: single wire, bidirectional --> half-duplex > > > > RS232: two wires, one per direction --> double simplex, effectively > > equivalent to full duplex > > > > Looks like a pretty solid "no" being the answer to that question to me. > > Thanks Hans. I did a little more digging into it and I think the > answer is indeed "No", but it has more to do with electrical > characteristics than half/full duplex. LIN signal levels are +12V > and ground. RS232 are +5V and -5V wrt ground. That's why you can't > just wire the LIN and the RS232 to each other. > << > > Er, no. > - RS-232 is +/-12V.
I was looking at page 123 of Jan Axelson's book "Serial Port Complete" where it states: "At an RS232 data output, a logic 0 is defined as equal to or more positive than +5V, and a logic 1 is defined as equal to or more negative than -5V. ... Because an RS232 receiver may be at the end of a long cable, by the time the signal reaches the receiver, its voltage may have attenuated or have noise riding on it. To allow for this, the minimum required voltages at the receiver are less than at the driver. An input more positive than +3V is a logic 0. An input more negative than -3V is a logic 1. The logic level of an input -3V and +3V is undefined."
> - RS-485 and RS-422 are 5V/0V.
RS485 and RS422 are differential signals, and their voltage wrt ground doesn't matter at all so long as it is less than 7 volts. At an RS485 receiver, the voltage differential between the A and B inputs needs to be just 0.2V. If A is a least 0.2V more positive than B, it is a valid logic 0. If B is at least 0,2V more positive than A, it is a valid logic 1.
> Whatever: level translation is easy.
A LIN bus is held at +12V wrt ground by a pullup resistor. The transmitter pulls it to ground to create the opposite logic level. An RS232 input expects to see at least +3V wrt ground for one valid logic level, and -3V wrt ground for the opposite logic level. I'm sure this can be done with the proper electronics, but my original question was whether or not I could just connect the wires. I think the answer is "No".
Paul Keinanen wrote:
> On 9 Dec 2006 22:44:06 -0800, cs_posting@hotmail.com wrote: > > >The more challenging part is figuring out how to tri-state the PC's > >RS232 transmit line so that it can listen. You could probably do it > >with some active device (analog FET switch?) controlled by one of the > >status lines. This shouldn't be hard to squeeze into the connector > >shell, but wouldn't be all passives. > > The common (but non-standard) way to allow multiple RS-232 > transmitters on the same line is to connect a diode between the Tx pin > and the common bus (with anode at the Tx pin). The line is actively > driven only to the "0" (space) space, while the internal receiver > resistors pulls the line to Mark ("1") state. With long lines, it > might be a good idea to run a resistor from the common point to -12 V > (e.g. DTR driven inactive) to maintain a stable Mark state.
Thanks Paul. Do you a link to a web site that discusses this approach in a bit more detail, and maybe elaborates on some potential pitfalls to watch out for?
> However, I have no idea, what the LIN character structure is, is it > even asynchronous (start/stop bit) and are the speeds compatible with > what you might find on PCs.
LIN baud rates are between 2 and 20 Kbaud. It is asynchronous. I have since found there are LIN/RS232 converters out there, that you can place between the LIN bus and your PC's RS232 connector. The simpler ones do not do any baud rate translation or any other translation. All they do is take care of the logic level voltage mismatch, and allow you to connect both the TX and RX RS232 signals.

The 2024 Embedded Online Conference