I’ve noticed on SC13 (haven’t looked on other chips yet) that there is a significant delay when using UART.Write. In the attached screenshot if you look at the two traces circled in red you’ll see the following:
Blue arrow: The code line immediately before UART.Write which enables an RS485 TX Driver.
Gap between blue arrow and start of the first 19 byte transmission is 3.4ms
Gap between 2nd blue arrow and the start of the second 170 byte transmission is 35.8ms
It looks like the UART.Write takes time to ‘prepare’ the Write, which varies according to the size of the write. Is that expected? It seems like a long time on the 170 byte transmission (more than twice as long as the actual Write).
Any ideas for improving that? I lose a fair bit of available bandwidth on my bus because of it.
Thanks Dat. Looks like it does only happen on a busy CPU. It works very quickly in an application with only uart.write regardless of the write size. I’ll try to reproduce in an example project because it does always vary according to write size in production and so it doesn’t quite seem like a random delay caused by other threads, it’s very consistent.