cancel
Showing results for 
Search instead for 
Did you mean: 

Strange Behaviour HAL_TIM_PWM_Start_DMA

Simi_Myr
Associate

Hello everyone.
I am encountering a very strange issue with the STM32H7B0 using the J-Link to debug.
I followed this tutorial to control the WS28B12 LED using Timer, PWM and DMA.
I use the following function to transmit the PWM data. 

if (HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, address, 74) != HAL_OK) Error_Handler();

 But here comes the strange thing:

If i run the code, nothing happens, or lets say, the data doesn't get transmitted:

Simi_Myr_0-1741345039513.png

But if i look at value of the address variable in the debugger before running the ...Start_DMA...:

Simi_Myr_1-1741345266206.png

And then Resume the program it suddenly works:

Simi_Myr_2-1741345326500.png

Why does this happen?
Any help is appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @Simi_Myr

The behavior that you're describing, where the program works after inspecting the variable in the debugger, means that there might be a timing issue or a need for a delay! This is probably related to the debug mode settings.

Try adding  a breakpoint in your callback function to monitor the execution flow and ensure that the source data has been transferred to the destination buffer 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Sarra.S
ST Employee

Hello @Simi_Myr

The behavior that you're describing, where the program works after inspecting the variable in the debugger, means that there might be a timing issue or a need for a delay! This is probably related to the debug mode settings.

Try adding  a breakpoint in your callback function to monitor the execution flow and ensure that the source data has been transferred to the destination buffer 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

TDK
Guru

> the data doesn't get transmitted

Looks like your code sets everything to 0, or at least most of it (50/74 values) but we can't see the rest. The data looks like a bunch of 0's being transmitted.

TDK_0-1741357593852.png

 

If you feel a post has answered your question, please click "Accept as Solution".