gicking / LIN_master_Arduino

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

Timeout for break received and for frame received is too short #5

Closed GuenterNo closed 1 year ago

GuenterNo commented 1 year ago

I have worked with the example "LIN_blocking" on an ESP32 and found one problem in two places of the code. 1) in LIN_Master::handlerSend, when the firmware waits for the break to be received, the timeout is 500 microseconds. This is too short for a break signal. At 19200 baud (half data rate 9600 baud) a break takes about 1000 microseconds. With a timeout of 500, the firmware will always run into a timeout 2) in LIN_Master::HandlerReceive there is the same problem when the firmware waits for the frame to be received.

It helps to set the timeout to 5000 although I did not check if this is long enough for the maximal allowed frame length.

gicking commented 1 year ago

The reason is that Arduino on ESP32 uses the RTOS running on the 2nd core for UART handling. Anyway, please download and install the library again. If it works now, I'll release a new version.

Note: this library was initially intended for ATMega and later ported to ESP32. Under https://github.com/gicking/LIN_master_portable_Arduino you find another LIN library which was with portability in mind.

GuenterNo commented 1 year ago

Thanks you for the quick reaction. The timeout is now changed to from 500 to 1000, this is enough to receive the break signal. This issue is fixed.

GuenterNo commented 1 year ago

Dear Georg,

thanks for your quick reaction. I have testet the modifications (change in baud rate switching and longer timeout), it works fine for me. And I have closed the two issues on GitHub.

Yesterday I had to re-install the Arduino IDE on another PC. hen I install the 1.4.0 version of the library, then I do not get the bug fixes. Bt when I download the archive directly from GitHub, I get the latest version,

I would like to propose to release a new version.

Thanks, Guenter

Am 15.03.2023 um 05:58 schrieb Georg Icking-Konert:

The reason is that Arduino on ESP32 uses the RTOS running on the 2nd core for UART handling. Anyway, please download https://github.com/gicking/LIN_master_Arduino/archive/refs/heads/master.zip and install the library again. If it works now, I'll release a new version.

Note: this library was initially intended for ATMega and later ported to ESP32. Under https://github.com/gicking/LIN_master_portable_Arduino you find another LIN library which was with portability in mind.

— Reply to this email directly, view it on GitHub https://github.com/gicking/LIN_master_Arduino/issues/5#issuecomment-1469335860, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6PY3IPMHPGGTTTKFLY2JKDW4FD6HANCNFSM6AAAAAAV26LUUE. You are receiving this because you authored the thread.Message ID: @.***>

-- Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft. www.avast.com

gicking commented 1 year ago

Dear Guenter,

thanks for the feedback and the reminder! Actually I was just waiting for your confirmation to trigger a new release - and then I forgot... 😉 I just created a new release (v1.5), which should show up in the Arduino library manager within a few hours.

Have a great day!

Georg

GuenterNo commented 1 year ago

Thanks!

Am 21.03.2023 um 09:28 schrieb Georg Icking-Konert:

Dear Guenter,

thanks for the feedback and the reminder! Actually I was just waiting for your confirmation to trigger a new release - and then I forgot... 😉 I just created a new release (v1.5), which should show up in the Arduino library manager within a few hours.

Have a great day!

Georg

— Reply to this email directly, view it on GitHub https://github.com/gicking/LIN_master_Arduino/issues/5#issuecomment-1477437657, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6PY3IJ37PCND4AG2SZP4O3W5FRBFANCNFSM6AAAAAAV26LUUE. You are receiving this because you modified the open/close state.Message ID: @.***>

-- Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft. www.avast.com