r/MicroPythonDev • u/lndshrk-ut • Jun 01 '26
Interrupt driven CAN/TWAI ISO-TP
I'm just starting a project that will first run on a C6 and later on an S31.
I want to use micropython to give end users the ability to customize.
Is it possible to write an interrupt driven CAN stack and then add the module to micropython? I've seen more than one "polling" version, but with packets flying at 500k, I'm pretty sure that polling via Python (multiple layers deep) is just going to drop packets and to put it lightly - that would be bad. Really bad.
I could keep it all in ESP-IDF and skip micropython but that ends user customization.
Would love some thoughts.
View all comments
Show parent comment
1
u/lndshrk-ut Jun 01 '26
Thanks,
Esp32 has a version, but again polled.
My intent is something like this.
Micropython fills buffer with message
μPy pass buffer and length to external C routine & call.
C Return status code and length of reply data to μPy
(If we had anything but success, the buffer still contains the original transmission for a retry)
(Assuming success)
μPy uses data in shared buffer to do stuff.
All of the fiddly time sensitive stuff is done by C behind the curtain.
Micro