Closed gbkwiatt closed 1 year ago
You're trying to reverse engineering the bus messages. First step should be to verify the baud rate. Since LIN has a standardized protocol, you should look for the common sync byte an plausible byte blocks. A scope will help you to identify that. If you don't have one available, may a high sample record will do the trick (Take a look into audio / wave record for signal analysis). Guess there is a periodic status message. and by changing the configured color, there will be send an additional config message. But in my point of view there are just three options: Lucky shot (by varying the rate until you have success), take a deeper look into the transient signal and analyse it or try to auto identify the correct baud rate by using information like all rising (and/or falling) edges of the sync byte.
The 8 bit Sync field has a predefined value of 0x55 (in binary, 01010101). This structure allows the LIN nodes to determine the time between rising/falling edges and thus the baud rate used by the master node. This lets each of them stay in sync. Source: https://www.csselectronics.com/pages/lin-bus-protocol-intro-basics
I've finally figure it out. Crucial here was correct baud rate and as everywhere states, usually 9200 is default and "most common" but wasn't in my case. I think VAG group has 10417 and this was correct in my case. Once I've got correct baud, I've started receiving correct messages with 0x55 as a sync. I was also able to successfully send a message
Hey, I was reading a lot about LIN and trying to find some libraries and examples. But nothing matches to what I am receiving, and I am pulling my hair on that. I wonder if you could maybe help me, I know It's been a year since you've pushed to that repo but worth a shot.
So I have LIN in my car for ambient lighting and LED modules. It constantly sends loads of messages but they are same messages. I think it should be something similar to https://github.com/MarkusLange/APGRD004/blob/main/src/apgrd004.cpp
so I've used your library and id didn't really give me an answer either.
While I understand I should have break
0x00
and sync0x55
I can't seem to figure out what I am receivingHere is an example
So when I was playing in the car and changing colors, it was sending longer message which looks like repeat of previous state plus new state request (?) dots in example are just repeated previous line (it's spamming those lines so I think it could be slaves sending current state ?)
since
0x00
is my break byte, does that mean0x20
is my sync byte ? then next byte would be PID or ID ? Also last byte should be CRC but that does not make sense either since last byte is always0x26
My goal is so I can trigger LED module from my car on my bench, but I am getting nowhere. And all examples over the internet are nothing alike to what I am getting.