Multiple USB CDC - async write issues #13040
-
Hello community, I'm working on a project which requires multiple CDC interfaces. I have succesfully patched micropython rp2 port to setup 4 additional interfaces on Raspberry Pico and implemented C module (ttyacm, based on original code found on RPI forum - author hippy) which calls underlaying tiny usb library. Still wip, but so far so good. I have an example test which writes some bytes asynchronously using I used git bisect to find the first commit which breaks the funcionality and found commit: 8c432ea This commit is: `rp2: Remove 1ms timeout to make idle waiting tickless. main.py:
When I try to use simple non-async version, it works as expected...
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @mishal, The rp2 port regularly pauses by issuing the WFE (wait for event) instruction, which suspends the CPU until an interrupt or other event triggers. Prior to the linked commit, the rp2 port would receive an interrupt at least every 1ms to wake up the CPU, at which time the MicroPython runtime might do some other processing (like calling scheduled functions, for example). This is very similar to a "tick" interrupt [^]. After the linked commit, this 1ms wakeup no longer happens. If there isn't an interrupt to trigger progress, the CPU stays asleep ("tickless"). To work, any driver will need to ensure that there's an interrupt (or a WFE-compatible Event) whenever it has to progress its state, it can no longer rely on the MicroPython runtime waking up every millisecond and potentially polling it. Does that answer your question? [^] In the case of the rp2 port it's not exactly a tick interrupt because it doesn't happen every 1ms, instead the CPU stops executing for at most 1ms. But it's similar to one, for the purposes of this question. |
Beta Was this translation helpful? Give feedback.
@projectgus thanks, was fixed by merging #13096