• None of those methods is great. It's virtually impossible to ever get a string of data that you can send. Sure, you can do a little better sometimes, but really not that much and there are loads of cases where it's very hard to improve.

    Can you not do what we do on nRF5x? Figure out what we need to send in an IRQ that happens just before data is sent?

    If not, how about:

    • In jshUSARTKick, schedule a Utility timer callback (jstimer.h) for 1ms if one hasn't already been scheduled (just have a bool for whether it has been scheduled or not).
    • When that fires, grab the data and transmit it
    • When the transmission finishes, if there is more data then transmit that too

    Or just skip the timer and send the first character on its own. That's what I did originally and it works reasonably well.

About

Avatar for Gordon @Gordon started