Skip to main content
AShaban
Associate
September 30, 2021
Solved

CubeIDE 1.4 Hangs Using FreeRTOS

Hello everyone,

I have Nucleo-L4P5ZG and the development environment is WIN10 , CubeIde1.4 and CubeMx 6.2.

I am facing a strange behavior while I'm trying to debug a simple FREERTOS toggle Led code here are details:

1- I started with Cube Mx and generated code for Cube IDE with the following configurations:

  • Only GPIO Pin PB7 [LD2= Blue Led on Nucleo] configured as output
  • Sysclk = 120 MHz drived by PLLCLK which is drived by MSI = 4MHz
  • Select FreeRtos Support without creating any OS resources except the Default task
  • Select TIM7 as a systick timer

and that's it.

2- I put the toggle led code in the default task

void StartDefaultTask(void *argument)
{
 /* USER CODE BEGIN 5 */
 /* Infinite loop */
 for(;;)
 {
 osDelay(1000);
 HAL_GPIO_WritePin(GPIOB, LD2_Pin, GPIO_PIN_RESET);
 osDelay(1000);
 HAL_GPIO_WritePin(GPIOB, LD2_Pin, GPIO_PIN_SET);
 }
 /* USER CODE END 5 */
}

3-Everything is working fine without launching the debug session

4-When I started debug session the code stops at main function as expected and when I pressed the play button the Led started to toggle

5- when I stopped and relaunched the debug session I noticed that code doesn't stop at main function and

  • LD2 Blue Led is not toggling
  • LD3 [RED Led on Nucleo] and LD8 are on

6- when I stopped and relaunched the debug session again everything works as expected but this scenario must be repeated (one time debug hangs and nothing works then the next one everything is perfect)

I need to know the reason behind this hang behavior?

Thanks in advance.

Edit: Project is attached

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
October 3, 2021

6 replies

TDK
September 30, 2021

In the stuck state, hit pause and see where the processor is at. Sounds like it may be a debugger initialization issue.

Latest CubeIDE version is v1.7.0, might see improvements there, might not.

"If you feel a post has answered your question, please click ""Accept as Solution""."
AShaban
AShabanAuthor
Associate
October 3, 2021

Dear TDK,

Thank you so much for fast response.

Regarding where the processor is at, here what I got when pause is pressed : Break at address "0x1fff16a8" with no debug information available, or outside of program code.

Regarding using Cube IDE 1.7 instead 1.4, I tried V1.7 and nothing is changed the same behavior still exists.

Any other suggestions ?

Thanks.

TDK
October 3, 2021
That address is in the system bootloader which explains the LED behavior. Not sure why it would be there, however.
"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
waclawek.janBest answer
Super User
October 3, 2021
AShaban
AShabanAuthor
Associate
October 4, 2021

Thanks waclawek.jan ,the issue is resolved after applying the patch.