LIN bus reader

Hello,
I'm working on a project with a lot of automotive components that communicate over LIN. They send out faults and status over LIN, as well as wakeup signals. Since it's pretty inconvenient to plug them into the vehicle or borrow the supplier's testing devices, I thought I'd build my own. The devices should all be slaves on the LIN bus

Right now, I'm trying to gather information about what the best way to approach this project is, with respect to reading LIN signals.

Should I buy a Macchina M2? It's expensive but theres a lot of functionality. An MCP2003 chip? Is an arduino UNO capable of being a LIN master? Are there any shields you know of? Other possibilities I haven't considered?

Thanks

Are there any shields you know of?

Google is your friend:

I saw that, but software support is pretty sketchy. They even say they don't have their own library.

Hi,

Have you googled arduino lin bus

This might help, it also has an arduino based LIN project.

http://skpang.co.uk/catalog/linbus-breakout-board-p-1417.html

also

Tom.... :slight_smile:

Yes, naturally I've done some research on this. I ask because I'm trying to get some more information. Perhaps some option is preferable based on my application. Maybe someone has some experience with one of these.

I've seen that break out board. It looks good, but if you look at their documentation, it's for a project using a different board all together. I don't want to drop my money and time on a product with shoddy documentation and support.

AFAIK USART0 of Sam3x8e (Arduino DUE) provides a LIN interface:

See Sam3x datasheet, page 770:

LIN Mode (USART0 only)

̶ Compliant with LIN 1.3 and LIN 2.0 specifications
̶ Master or Slave
̶ Processing of frames with up to 256 data bytes
̶ Response Data length can be configurable or defined automatically by the Identifier
̶ Self synchronization in Slave node configuration
̶ Automatic processing and verification of the “Synch Break” and the “Synch Field”
̶ The “Synch Break” is detected even if it is partially superimposed with a data byte
̶ Automatic Identifier parity calculation/sending and verification
̶ Parity sending and verification can be disabled
̶ Automatic Checksum calculation/sending and verification
̶ Checksum sending and verification can be disabled
̶ Support both “Classic” and “Enhanced” checksum types
̶ Full LIN error checking and reporting
̶ Frame Slot Mode: the Master allocates slots to the scheduled frames automatically.
̶ Generation of the Wakeup signal
Test Modes
̶ Remote Loopback, Local Loopback, Automatic Echo
Supports Connection of Two Peripheral DMA Controller Channels (PDC)
̶ Offers Buffer Transfer without Processor Intervention

Guys,
has anyone figured out a way to sniff LIN signals on arduino pro mini without additional hardware?
i do not need to send anything on the bus, just pick up some of the data and process it.
thanks.

1 Like

I think you will need a voltage divider (two resistors) since the standard specifies 12V signals.

Yep i can do that, or iuse a max2323 RS232 to TTL level shifter.
but everywhere i read about LIN it was mentioned that you need an external LIN transciever, question is if i can read the LIN data using regular serial (after shifting voltage levels)?

For receiving only, you don't need a special transceiver.

It should read fine. If not, try SoftwareSerial with the inverted-polarity option.

thank you, i will try it and report back.

Reporting back after some good progress:

i was able to read data and deocde the protocol i needed with using just a voltage devider from LIN to Arduino UART.
now the next stage is to transmit commands on the LIN bus.
i sniffed the line with a logic analyser and transmitted via Arduino UART with a level shifter to LIN votage level, but the other node on the bus doesnt respond. i think this might be due to the very fast slew rate of the level shifter as it is MOSFET based (30ns/12v) - the LIN standard calls for about 6us/12v).

anyway, seems like the next logical step is adding a proper LIN transciever to my boards.
i have ordered a few TJA1020 and TJA1021 transceivers for testing - any help on connecting these would be greatly appriciated.

my code already handles the protocol and data layer perfectly, i just need the transciever to act as a UART - > LIN HW converter.

thanks.

1 Like

Hi buddy,

Any updates with you project? did you manage to send and receive data over LIN 1.3 and 2.0?

Thanks.

Kris.

i3dm:
Reporting back after some good progress:

i was able to read data and deocde the protocol i needed with using just a voltage devider from LIN to Arduino UART.

Do you mind sharing how you connected? I'm trying to just read and decode the LIN on an Arduino Nano.

i added a LIN transceiver.

if you want to just read LIN, use a simply voltage devider on data line to Arduino Rx.

Do you have a connection diagram for this?

LIN bus -- resistor - Arduino RX -- resistor -- vehicle ground ?

i3dm:
i added a LIN transceiver.

if you want to just read LIN, use a simply voltage devider on data line to Arduino Rx.

Can anyone share any further details on sniffing the LINBUS data on a vehicle. Is an Arduino nano suitable? Can someone further explain the voltage divider? I understand in principle sniffing the LINBUS is relatively simple once you have your setup complete. I just need a little guidance. Thanks I’m advance.

you can sniff the LIN bus using any arduino UART line as long as you lower the LIN signal voltage to 5V which arduino uses.

you lower your voltage by making a simple voltage divider (2 resistors). i can add a scheme later but you can easily find it on google.

you can also use an off the shelf level shifter to 5V.

That's great news. I am just starting this project so reading and learning alot! Its a lot to learn but I love a project, apologies if I am slow to absorb. So first step is to take the LIN line through two resistors then onto the UART RXD line. This will lower the LIN voltage from 12v to the 5V required by the Arduino. I have found a level shifter that will will take 1-12v in 1-12v out so thats covered. Once this is connected correctly I assume also that the vehicle LINBUS runs off LIN/12v/Ground. Do I need to take all three to the Arduino? Or just the LIN line as the power and ground are handled by the Arduino?

i3dm:
you can sniff the LIN bus using any arduino UART line as long as you lower the LIN signal voltage to 5V which arduino uses.

you lower your voltage by making a simple voltage divider (2 resistors). i can add a scheme later but you can easily find it on google.

you can also use an off the shelf level shifter to 5V.

So I now have my first Arduino Nano. I hoped that loading a LIN Sketch would be simple but it won't verify and is full of things not declared in the scope! Kind of lost with how to even load a LIN Sniffing sketch to the Arduino to even get started!

Edit: So with some more reading the errors are because the sketches and LIN STACK were compiled for the Arduino Due and not the Nano, the issues are reference the Serial1/SerialUSB etc references which the Nano does not have.

Where can I find sketches and LIN Libraries for the Nano? Or is this something I need to start compiling myself?