cancel
Showing results for 
Search instead for 
Did you mean: 

STM32wb55 HAL_Delay() Function

AKetc
Associate III

Hi everyone,

I have been stuck at a problem. I have been trying to configure HAL_Delay function to work in STM32 BLE_Server example in the STM32WB SDK. However, for some reason, the code gets stuck inside the HAL_Delay() Function. I have searched over the internet and tried the solution to increase Systick interrupt priority. Still there's no solution to my problem. Please help me out.

20 REPLIES 20
Christophe Arnal
ST Employee

​Hello,

In all BLE Applications, the HAL_Delay() was not used so in order to save power ( avoiding the systick periodic interrupt timer), it was decided to disable the systick.

As long as the systick is not enabled, the HAL_Delay() cannot exit anymore.

In main.c, the two following weak functions have been overloaded with empty function

This prevents the HAL to enable the systick.

/**
 * This function is empty to avoid starting the SysTick Timer
 */
HAL_StatusTypeDef HAL_InitTick( uint32_t TickPriority )
{
	return (HAL_OK);
}
 
/**
 * This function is empty as the SysTick Timer is not used
 */
void HAL_Delay(__IO uint32_t Delay)
{
	return;
}

In order to get back the systick, you need to remove these two implementations from main.c

In the next release v1.3.0, the HAL_Delay() will be available by default as the lost of power consumption is marginal versus the fact it is a friendly service to be used in the appplication

Regards.

Stm32WB55CC with 1.8.0 pack has got the same problem. Systick is frozen. But solution from @Christophe Arnal​ not working... Also if I select Timebase Sourse = TIM1, program breaks somewhere in HAL_Init();

0693W000004K8mxQAC.png

​Hello,

The original problem was that HAL_Delay()  was implemented empty in our earlier packages. Now, there is an implementation of HAL_Delay() in main.c which is slightly different compare to the default one from the HAL.

In which BLE example provided in v1.8.0 Cube Package did you notice the HAL_Delay() is not working as expected ?

Regards.

STM32CubeIDE 1.4.2 with 1.8.0 pack.

I generate new project for WB55CC in CubeIDE and try to do blink led:

0693W0000058uQaQAI.pngI go to debug and do first step

0693W0000058uPmQAI.pngI try to do second step, but prog going away.

0693W0000058uRxQAI.png 

This was "TIM1 problem". Next is about "Systick problem".

I select Timebase Sourse = SysTick, generate code. Debugger do all steps before while(1).

while (1)

 {

   /* USER CODE END WHILE */

   /* USER CODE BEGIN 3 */

       HAL_GPIO_TogglePin(Buz_GPIO_Port, Buz_Pin);

       HAL_Delay(200);

 }

But after HAL_Delay(200) prog is infinity wating. I pause via debugger and I can see

0693W000004K8mxQAC.pngLook at attachment.

​Hello,

I added the STM32CubeMX stamp as I believe the problem is not linked to either BLE or STM32WB but more on the way STM32CubeMX has generated the application.

From the time being, I would recommend to have a look to \Projects\P-NUCLEO-WB55.Nucleo\Examples\HAL\HAL_TimeBase_TIM which provide an .ioc with TIM17 used to generate the tick for HAL_Delay().

Regards.

This was power supply problems on my pcb. And BOR_LEV was default (off).

Now I test stm32wb55CC with all timbase sources: systick, TIM1, TIM2, TIM16, TIM17 on pack 1.9.0 and it is works.

Sorry for my disturb @Christophe Arnal​ 

​Hello,

Great to read you were able to fix that issue.

Regards.

I got systick problem! I use all timers and:

void SysTick_Handler(void)

{

 /* USER CODE BEGIN SysTick_IRQn 0 */

 /* USER CODE END SysTick_IRQn 0 */

CubeMX forgot HAL_IncTick();

 /* USER CODE BEGIN SysTick_IRQn 1 */

 /* USER CODE END SysTick_IRQn 1 */

}

The joke is that in project "CC_testSystick" 1.5MB above no this problem. I think this is because in proj above I use only one timer at one time.

Pack v 1.10.1

0693W000007ERIcQAO.png

any news? @Imen Ezzine​ @Christophe Arnal​ 

I Found the same issue again where systick fails to start;

Fixed by selecting a different toolchain.

Using the cube, under Code Generator,
output format GPDSC Toolchain --- failed
But using MDK Toolchain. ----- worked

Using H7

TJ.