3

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

Nick Alexeev
  • 37,739
  • 17
  • 97
  • 230
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/86578/discussion-on-question-by-bart-admiraal-stm32-cant-get-dma-on-pwm). – Nick Alexeev Dec 04 '18 at 00:45

1 Answers1

2

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.

clabacchio
  • 13,481
  • 4
  • 40
  • 80