cancel
Showing results for 
Search instead for 
Did you mean: 

Debug stuck in LL_RCC_PLL_IsReady

viniciusfre
Associate II
Posted on April 09, 2018 at 16:58

Hello,

I have a Nucleo-L476RG and I am trying to debug using openocd. I am able to reach main() function, but when it

calls SystemClock_Config() get stuck in:while(LL_RCC_PLL_IsReady() != 1)

The firmware does not get stuck when running without debug. This happens only in debug mode.

void SystemClock_Config(void)
{
 /* MSI configuration and activation */
 LL_FLASH_SetLatency(LL_FLASH_LATENCY_4);
 LL_RCC_MSI_Enable();
 while(LL_RCC_MSI_IsReady() != 1) 
 {
 };
 
 /* Main PLL configuration and activation */
 LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2);
 LL_RCC_PLL_Enable();
 LL_RCC_PLL_EnableDomain_SYS();
 while(LL_RCC_PLL_IsReady() != 1)
 {
 };
 
 /* Sysclk activation on the main PLL */
 LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
 LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
 while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) 
 {
 };
 
 /* Set APB1 & APB2 prescaler*/
 LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
 LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
#ifndef RTOS_FREERTOS
 /* Set systick to 1ms in using frequency set to 80MHz */
 /* This frequency can be calculated through LL RCC macro */
 /* ex: __LL_RCC_CALC_PLLCLK_FREQ(__LL_RCC_CALC_MSI_FREQ(LL_RCC_MSIRANGESEL_RUN, LL_RCC_MSIRANGE_6), 
 LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2)*/
 LL_Init1msTick(80000000);
#endif
 
 /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
 LL_SetSystemCoreClock(80000000);
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

#stm32l4 #debug_mode
1 ACCEPTED SOLUTION

Accepted Solutions
viniciusfre
Associate II
Posted on April 10, 2018 at 05:30

Hi,

I figured out the problem. I was not calling 'load' command after 'monitor reset init'. So the correct commands are:

$ arm-none-eabi-gdb build/hello-world.elf

$ (gdb) target remote localhost:3333

 

$ (gdb) monitor reset init

 

$ (gdb) load

 

$ (gdb) break main

 

$ (gdb) continue

View solution in original post

3 REPLIES 3
Posted on April 09, 2018 at 18:21

>>The firmware does not get stuck when running without debug. This happens only in debug mode.

And what tool chain are you using?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
viniciusfre
Associate II
Posted on April 10, 2018 at 05:30

Hi,

I figured out the problem. I was not calling 'load' command after 'monitor reset init'. So the correct commands are:

$ arm-none-eabi-gdb build/hello-world.elf

$ (gdb) target remote localhost:3333

 

$ (gdb) monitor reset init

 

$ (gdb) load

 

$ (gdb) break main

 

$ (gdb) continue
Posted on April 10, 2018 at 05:30

arm-none-eabi-gcc