2
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Nick Alexeev Dec 4 '18 at 0:45
2
\$\begingroup\$

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.

\$\endgroup\$
  • 2
    \$\begingroup\$ Is this the solution to your issue, or just an additional clarification? \$\endgroup\$ – W5VO Dec 3 '18 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.