Hi Salman
Attachment is an example code for implement a master node for LIN J2602.
This example run in EVB9S12EXP100 STARTER KIT REV B.
In this example I use BUS clock 2M, and the calculate of baudrate have big tolerance. It is a limitation of current code. And to work around with this we can use another bus clock or add a below code to line 1741 of file lin_lld_sci.c.
a = (tmp+1)*16*lconf_p->baud_rate - MCU_BUS_FREQ;
b = MCU_BUS_FREQ - (tmp+1)*16*lconf_p->baud_rate;
if (a<b) {
tmp=tmp+1;
}
In the example I just add these code to make baudrate of lin bus close with true baudrate(10417 bps).
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------