Electronic – STM32 cant get DMA on PWM

dmapwmstm32ws2812b

I wish to drive a set of NEOPIXELS (ws2812b) using the STM32F4 discovery board, so far i managed to get a 800 kHz PWM signal using the CubeMX.
enter image description here

And

enter image description here
And the following code:

/* USER CODE BEGIN 2 */

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);

/* USER CODE END 2 */

But when i add these lines of code

/* USER CODE BEGIN Init */
uint16_t pData[25] = {8,8,8,8,8,8,8,8,4,4,4,4,4,4,4,4,2,2,2,2,2,2,2,2,0};

/* USER CODE END Init */

/* USER CODE BEGIN 2 */

//HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *)pData, 25);

/* USER CODE END 2 */

My PWM signal just disappears, what do i need to do to control the PWM with DMA?

edit:
It is posting the DMA sequence, but the DMA needs to be changed to circular to see it on a scope

Best Answer

The code was correctly transmitting the DMA sequence, but the DMA needed to be changed to circular or repeating mode to see it on a scope. When it was just running in linear or one-shot mode, I didn't have a chance to see the output the single time it was produced.

Related Topic