cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with HAL_Delay while using PWM+DMA in STM32WB55

Kolab
Senior

0693W000001syBGQAY.pngHello! I am using PWM to generate 1.25 ms period pulse to trigger a LED strip light . In main.c , properly in while(1) when I called HAL_TIM_PWM_Start_DMA followed by HAL_Delay the program got stuck in uint32_t tickstart = HAL_GetTick(); . When I runned the debug once again it now gets stuck in the place shown in the image (in the file startup_stm32wb55xx_cm4 )

How could I solve this?

4 REPLIES 4
TDK
Guru

HAL_Delay should work fine as long as it's initialized and the SysTick interrupt has a higher priority (numerically lower) than whatever interrupt you're in, if any. Check to see if uwTick is increasing.

Your debugging issue is a separate problem. "B ." will jump to the current address. Queue infinite loop. Probably shouldn't be making it to that statement. Issue a reset to get it to go back to Reset_Handler. Maybe your main() function is illegally returning. Hard to know without seeing any code.

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

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

HAL_GPIO_TogglePin(LD1_GPIO_Port,LD1_Pin);

HAL_Delay(100);

 }

even this code works weirdly. It sometimes works (when I randomly start or stop the debug) but often doesn't. I will show the clock configuration, may be something is not ok there0693W000001t4daQAA.png

It is in the Default_Handler, with hundreds of other IRQHandlers, because you don't have an IRQHandler defined for an interrupt you're using.

Review the Linker's .MAP file to confirm what and what is not bound properly.

Watch for one or more WEAK definition of the same handler.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Kolab
Senior

I suspect that it was happening because I didn't copy the interrupt functions to the file stm32wbxx_it.c . When I completely disabled the BLE in CubeMX it started working. Then I reactivated the BLE, left into while(1) that stays in main only the default task and used an other infinite cicle in p2p_server_app.c with HAL_Delay and everything got allright.