LIN protocol #1260
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
Did some reading and it looks that these Tinys 1626, 1624' do not have the "on-board" U(S)ART peripheral with the so-called 'LIN break field' ? Which is apparently only required for the Master. However, there seems to be the Slave support, more below. Anyway, after looking at the Serial Ref of the recent megaTinyCore (updated to the latest version as of Jan 2026) it looks the so-called Serial.breakAndSync(); does not want to compile, which would be very helpful, maybe I am using it wrong, please advice how to use it?However, there are other practical solutions for such a case, next follows one of them. The idea is to slow down the baud rate while sending the 0x00 and then returning it back to the normal LIN baud rate (in my case, 9600). Apparently this is the industry practice when dealing with the uC without "on board break field" :) Indeed , the only confirmation will be when tested on a LIN slave. Best. |
Beta Was this translation helpful? Give feedback.





Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all and happy 26!
Time allows me to put together the LIN protocol. The hardware seems to be working!
I am on 1626 as master and 1624 as slave, both have the TJA1027 transceivers and 2nd serial is used for the debugging on both.
Started with the so called LIN frame, but cannot get around it, I can successfully observe the output on the "lin bus" via the LOGIC analyser. For reference I am following this doc, its "recent" lin version, namely 2.1.
Here is the (starting) code:
The setup:
The header test:
In general, the LIN frame starts with the header that has the 'break, sync and PID field', see p. 28 for more...
The analyser capture:

Apparently this works, however, I guess that the error (violet) on LIN: Data is due to the fact the Frame is complete ?
Anyway, next follows the "complete LIN frame" :
Including the PID and Checksum callculations:
My 1st consideration is wether the "delay", for example, used for the "delimiters", e.g. see break delimiter:
delayMicroseconds(100); // Break DelimiterI guess this should not be actual delay() which stops the whole uC, but rather a "pause", do I understand this properly?
Here is the analyser output:

And here is the loop()
To conclude, I am not sure where I am making it working, but somehow I cannot get read of the LIN: Data error (the violet bar).
It looks that "checksum" is not OK? For example, the calculated checksum seems to be : 121 while the analyser finds it: 79 .
Not sure what is going on :)
Best.
PS wanted to use the Serial Double break as described here
but not sure how to work it out?
Beta Was this translation helpful? Give feedback.
All reactions