Is the iso-tp library usable on a non RTOS microcontroller?

The library is written for the Arduino and an example sketch is provided.

The code for short messages looks OK.
However, for multi-part messages it looks like the sender can get stuck for 250 milliseconds in a while loop in the ISOTP_WAIT_FIRST_FC state waiting for a handshake response, or a timeout which puts the state back to ISOTP_IDLE, or else encounter an error of some kind.

while(msg->tp_state!=ISOTP_IDLE && msg->tp_state!=ISOTP_ERROR)

On an RTOS you could run this in it's own task so it doesn't block, however on a superloop Arduino I don't see how you would be able to use it in a practical way. Simply reducing the timeout isn't going to work as this will sometimes cause the sending of multi-part message to fail.

If what I'm saying is correct, is there an easy fix?

if watchdog is the issue you hint at then add a call to yield() in this while() loop. that would give a chance to the rest of the system to work but might mess with timings

Actually I wasn't thinking of the watchdog specifically, just the implications of a main loop that could end up only running at 4Hz.

This sure is a potential issue if you need to do other stuff…

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.