RP2 (RPi Pico): Minimize effects of REPL USB VCP on PIO IRQ #9442
Replies: 4 comments 2 replies
-
Do you need to use an IRQ? You can poll the FIFO with |
Beta Was this translation helpful? Give feedback.
-
Polling would require the print() to work synchronously at the sampling rate (16 kHz) - I wasn't sure that would work so I attempted to separate acquisition and output via the FIFO buffer as a more general approach. |
Beta Was this translation helpful? Give feedback.
-
An IRQ occurring at a 16KHz rate is quite challenging. The fact that you can issue Consequently my reaction to the interrupt based solution is to be rather surprised that it works. A solution based on polling would still have to contend with GC, but you might have more control over when it can occur. |
Beta Was this translation helpful? Give feedback.
-
You may let the dma receive the data from the PIO (without interrupt) and collect it in a buffer or in 2 alternating buffers.
which is taken from example 2 of my RPI2040 dma class https://github.com/rkompass/RPi2040_mPy. The dma transfer to 2 alternating buffers is untested yet. What I tested was transfer from 2 alternating buffers to another destination (PWM in that case). But I think it should work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to buffer data from a PIO IRQ and transfer it to the USB host via print() in an otherwise empty "main" loop.
However, print() seems to block/delay the PIO IRQ so data is not captured properly.
The IRQ runs at about 16kHz at most, but there are pauses.
Buffering data first for later output eliminates the issue, but I would like to "stream" the data.
How could this [IRQ conflict] be avoided? With DMA or using the second core? Setting IRQ priorities?
Optimisations might be capturing two data words in the ISR and binary transfer, but the conflict would still occur..
Beta Was this translation helpful? Give feedback.
All reactions