cancel
Showing results for 
Search instead for 
Did you mean: 

stm32CubeMX HAL_Delay bug?

nikola1010
Associate II
Posted on December 15, 2015 at 10:38

Hi all,

Could someone also verify if there is a bug inside cube.

Steps involved to reproduce:

1. Generate basic template (stm32f407 discovery in my case) inside CubeMX

2. Inside main file write:

char buffer[]=''some text\n\r'';

 while (1)

  {

         HAL_UART_Transmit(&huart6,buffer,strlen(buffer),200);

        HAL_Delay(1000);

  }

Result: it works.

Now repeat same procedure but add FreeRTOS support.

Before kernel init and start run the same code.

while(1){

 

  HAL_UART_Transmit(&huart6,buffer,strlen(buffer),200);

        HAL_Delay(1000);

}

  /* USER CODE END 2 */

  /* Call init function for freertos objects (in freertos.c) */

  MX_FREERTOS_Init();

  /* Start scheduler */

  osKernelStart();

 

HAL_Delay function doesn't work!

5 REPLIES 5
schelven
Associate II
Posted on December 15, 2015 at 10:46

Hi, 

Although i am new to FreeRtos & CMSIS i guess you need to use osDelay(xx) instead of HAL_Delay(xx)

Rob

thln47
Associate III
Posted on December 15, 2015 at 12:23

Hi,

It's normal HAL_Delay use the ticks timer interrupt and freeRTOS too.

see my anwer to thomas, here

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/STM32CubeMx%204.12.0%20freertos%20missing%20HAL_IncTick()%20in%20SysTick_Handler()

nikola1010
Associate II
Posted on December 15, 2015 at 17:03

It seems that this same issue is making LwIP halt in ethernet configuration.

Stm32f4 with expansion board (ethernet) doesn't work and halts on HAL_Delay.

/**

  * @brief  Initializes the Ethernet MAC and DMA according to default

  *         parameters.

  * @param  heth: pointer to a ETH_HandleTypeDef structure that contains

  *         the configuration information for ETHERNET module

  * @retval HAL status

  */

HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth)

....

 HAL_Delay(PHY_RESET_DELAY);

....

daracerz
Associate
Posted on December 21, 2015 at 00:31

Seems to be an issue with the new 4.12 driver update to CubeMX.  Didn't have this issue with the previous version.  Same issue here where the SD Driver won't ever start because HAL_delay() never exits when FreeRTOS is enabled.

nikola1010
Associate II
Posted on December 21, 2015 at 10:54

Have you worked out any solution maybe?