I configured a DMA channel in scatter/gather to run a number of tasks, copying a table in memory and writing it to a PWM CMPA register. At the end of the table, an interrupt is generated to restart the process over.
By connecting a scope to the PWM output pin and manipluating the input table (the one get copied to the PWM CMPA register), I can see if all the updates are happing or not.
Since DMA can't get triggered by a PWM event, it is triggered by an edge event on the GPIO pin that is configured as a PWM. The PWM is set to update immediately (I.E. not sync to counter equal to 0).
By looking at the scope I can see that some of the table entries are not affecting the PWM output.
I originally had the GPIO configured to trigger on the falling edge but I changed it to the rising edge. This gives the DMA more time to copy the next table value to the PWM. This seems to work in a limited test situation. However, it indicates that it takes a not so insignificant amount of time for the GPIO to trigger the DMA to execute the next DMA task and for that task to actually copy a new value to the PWM. I would have thought this would happen in only several cycles (80MHz MCU = 12.5ns) but it seems to take a lot more. Something on the order of microseconds.
When I switched to rising edge, giving more time before the next PWM cycle, it worked better.
Is DMA in scatter/gather mode with a GPIO trigger that slow? Or am I still missing something?
Thanks