Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8026

MicroPython • Synchronizing PIO and DMA with Micropython

$
0
0
Hello everyone

I'm at a loss at the moment. Is there a way to synchronize PIO and DMA?

Initial situation: I have two DMAs that alternate and each fill their own array with bits. Always fixed 15360 bits. PIO runs with instructions to wait for pin 0 and as soon as 1, other pins are evaluated with in_. In order for the data to be usable, it is essential that the 15360 bits between two pins 0 = 1 are evaluated. So if a bit or more is missed, DMA would still obtain bits from the second cycle, as it has to be filled up to 15360. A switch is then made to DMA2, which then also starts recording in the middle of the cycle. The error then continues forever.

So is there a way to synchronize PIO and DMA, but for performance reasons at the PIO/DMA level? I have a solution with PIO and Micropython, but at 75 MHz sampling rate there are many read errors due to the lag of Micropython compared to PIO.

Some trick where a new run of the instructions results in a clean start of a new DMA with an empty array. If at the end of the instructions the array is not yet full, or the array is already full before the end, the DMA capture should be considered invalid and the next attempt should be made.

Greetings
Jack

Statistics: Posted by JackCode — Sun Aug 17, 2025 5:04 pm



Viewing all articles
Browse latest Browse all 8026

Trending Articles