LIN Bus communication

Hi there,

i have some questions regarding the lin bus library of macchina m2.
I loaded the default sniffer example and connected my macchina m2 parallel to the actuator, to see the communication between ECU and actuator.

|¯¯¯¯¯¯¯ | 12V ------------------------- OBD pin 16 |¯¯¯¯¯¯¯ |
| actuator | LIN ---------------------------- OBD pin 7| m2 UTD |
| _______| GND -------------------------- OBD pin 5| _______|

By measuring the LIN signal with the oscilloscope i got a baud rate of 10.4kbps
In the LIN Library is this baud rate set as default so i thought it should work.

Has anyone some ideas where the problem could be?
Thanks in advance!!

Those connections look correct. We’ll test out the LIN library again ASAP and report back.

I never got a reply to an earlier post of mine on another thread where I also failed to get anything meaningful when trying to sniff the LIN traffic

Does the LIN library work with Lin2.0?
Using the sniffer sketch I could only ever get it to print out one frames worth of data and even that never looked correct, ie the sync byte was never 55.
I purchased a cheap usb cro and could see plenty of data on the LIN bus entering the M2, and after performing a screen cap I could see that at least for the frame I was looking at it consisted of 4 frames, can be either 2,4 or 8, so 4 + sync + ID + checksum = 7 bytes in total
Setting my data & data_size to 4, 7, 11 … etc still only ever printed out 1 frames worth of data if I was lucky
Checking lin_stack.cpp is where I get a bit confused. lin_stack::readStream seems to take the data_size that is passed to it, but, does it then call lin_stack::read which then adds the extra 3 bytes for sync, ID & checksum.
These dont seem to be operating consistently.
Shouldn’t the sketch also wait until it sees the sync byte before starting its count?

Hi Josh, sorry for the delay but I’m very busy at the moment.
I figured out some things.
-> LIN CH 1 (OBD pin 7), does not work either as sniffer nor as master.
-> LIN CH2 (OBD pin 15), works as master(sending only), reading/request as master or as sniffer does not work.

I checked what the ECU is sending while the actuator is unplugged.
There are two kind of messages, the first one is a full message (header and data) the other is the header only.
When the actuator is connected, both messages are complete.

If i use LIN CH2 as master, I can reproduce the first (full) message and the actuator is moving.
I’m not sure what the second message is used for, but if I’m sending the request function from the library (header only) the actuator is also responding. I proved it with the oscilloscope, but I’m not able to read something.
Do you have any advice how to make a request or read data from the lin bus?
I can there be a problem with the reading?
I tried also the sniffer with channel 2 but even there macchina does not read anything.

There was also a something strange i cannot explain.
When I’m not sending anything to the actuator after some seconds it starts to move.

Thanks!

I am also having a similar problem. I though it was the speed setting in the header file being set to 19200, while the lin bus I’m listening to is 10417. I went back in history on github to a version of Lin_stack.h that had that as the speed and a period of 96. It did not solve the problem. Any suggestions would be helpful.
Thanks.