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

General • RP2350 PIO Ring Buffer variable length

$
0
0
Hello everyone,
I am used to work with STM32 and I am switching to RP2350 and the PIO.
I need to port a piece of code and take advantage of PIO but I would need some help to adopt the right design.

What the program is doing
- Loading a buffer of char in memory, this buffer has a length of X,
- Passing the content of the buffer to a PIO
- The PIO is sending a bit every 4 us for a duration of 1.3 us
- At the end of the buffer it start over with the beginning

The tricky part is that the number of bit to be send is not a multiple of 8 meaning that I can have a buffer of 32 char (256 bits) and only have to send 254 bits.
and the length of the buffer might change during the execution.

What is the best approach to use PIO in that case ?
- Having one core to fuel the PIO with 2x UINT16 where 1 uint8 is the char and the other is the number of bit ?
- How could I use the DMA in that case to avoid having one core dedicated to send data to the PIO?

thanks for your help
Vincent

Statistics: Posted by vibr77 — Wed May 28, 2025 6:23 am



Viewing all articles
Browse latest Browse all 8037

Trending Articles