gicking / LIN_master_Arduino

LIN master node emulation with preemptive background operation
MIT License
31 stars 3 forks source link

Long delay when switching baud rate back and forth #6

Closed GuenterNo closed 1 year ago

GuenterNo commented 1 year ago

Using the LIN_blocking example on an ESP32.

I noticed a delay of about 11ms between the BREAK signal and the SYNC signal. I could not yet check if such a long delay is permitted, but I have never seen such a delay before.

The root cause is that the call pSerial->begin(baudrate) takes 10 milliseconds. Why? This crashes the performance of the LIN interface. The while loop after the begin() takes no time.

gicking commented 1 year ago

see comment in Issue 5. This should also be solved. Please let me know if it works now

GuenterNo commented 1 year ago

The long delay is now gone by replacing pSerial->begin() with pSerial->UpdateBaudRate. The signal looks normal on the scope now. Still to be tested with a real LIN device.

GuenterNo commented 1 year ago

Tested with ESP32, MCP2003 and automotive LIN devices: ok.