I know a cool trick for this actually. The issue is the CPU is poll rate is critical. If you want to use the trick you need to let the DMA shutdown for safety.
The trick is to use 2D DMA and ownership flags.
The trick is to use 2D DMA and ownership flags.
Code:
struct blah {// We are ring mode 16Buint32_t ctrl;// The order of these may be wrong.void *src;void *dst;uint32_t len;// Verify the trigger}blah table[(2 * 5) + 1];// 5 buffers exist herevoid init_table() {static volatile uint8_t flag = 1;for (int i = 0; i < 2 * 5; i += 2) {table[i].ctrl = 0; // ???table[i].src = adc_ptr;table[i].dst = malloc(64 * sizeof(uint16_t));table[i].len = 64 * sizeof(uint16_t);}for (int i = 1; i < 2 * 5; i += 2) {table[i].ctrl = 0; // ???table[i].src = &flag;table[i].dst = malloc(1);*(table[i].dst) = 0;table[i].len = 1;}table[2 * 5].ctrl = 0;// ???table[2 * 5].dst = 0;table[2 * 5].src = 0;table[2 * 5].len = 0;}
Statistics: Posted by dthacher — Mon Apr 28, 2025 4:22 pm