Finding the right API for embedded framed protocol

If you're already paying the overhead of Linux to begin with, just use Tokio for the serial I/O. It can be faster to use spawn_blocking to handle a sequence of file I/O operations via std::fs instead of tokio::fs, but that's about the only gotcha I can see.

And it's immensely helpful when dealing with a device on the other end of a UART to have tracing spitting out Perfetto-compatible traces, so that you can look at the relationship between events nice and clearly.

2 Likes