DMA Mem to peripheral inconsistent output
I have a timer + dma which outputs a signal for addressable LEDS. The code calls the PWM Start function on a crude timer loop for testing purposes.
The first time the DMS starts, its perfect, and the output is correct and as expected. However the second, and subsequent times it executes, the first few cycles are incorrect.
Ive removed the boilerplate comments etc for brevity.
int timer = 0;
while (1)
{
if (timer >= 9000000) {
timer = 0;
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *)pwmData, sizeof(pwmData));
while (!datasentflag){};
datasentflag = 0;
}
timer++;
}The first output of the signal is correct as shown in the scope screenshot here...
The second output of the signal is not correct.
There is no change to the pwmData array during the execution, so i would not expect the output to change.
Any ideas on why this could be happening?
