HAL_TIM_PWM_Stop_DMA does not stop the timer pwm generation

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hey. I am writing a code to drive neopixel LEDs. I need to achieve specific timings to either '1' or '0'. I have set up my timer to 800khz as and set up a PWM dma to send a sequence of bytes for my led strip. I fill the led_array with duty cycle values and then enable the DMA to transfer all the data. When the data trasnfer flag is set , i disable the pwm dma but i can still see the PWM waveforms on my gpio pin.
I use this function to send 88 bytes of data that contain different duty cycles. Once I enable the PWM, I am able to see the data on the osciloscope and the waveforms is correct ( as expected). The only problem is that after I call the function HAL_TIM_PWM_Stop_DMA, the PWM generation does not stop. Any ideas? thanks.
C:
void Update_led_data(){


  HAL_TIM_PWM_Start_DMA(&htim3, TIM_CHANNEL_2, (uint32_t *)tmp_led_data,88);// send 88 bytes of data
  while(transfer_complete==0) // stay in this while loop till the flag is set in the dma interrupt handler
  HAL_TIM_PWM_Stop_DMA(&htim3, TIM_CHANNEL_2);

}
 
Top