Skip to main content
Visitor II
March 14, 2024
Question

STM32L052 crashes when executing SystemClock_Config when MSI_RC set to 65.536

  • March 14, 2024
  • 1 reply
  • 1035 views

I start a new project using STM32CubeIDE Version: 1.14.1 and select STM32L052K6T6.

All I change is the MSI_RC clock setting to be 65.536kHz.  This causes all the other clocks to change to this same freq.

I program the device and step through - execution freezes in SystemClock_Config.

I believe the problem is related to the system tick timer.  I note that in the NVIV config code generation tab that the "Call HAL Handler: option is ticked by default.  If I untick this, then SystemClock_Config executes.

I think all the handler does is to increment the tick:

void SysTick_Handler(void)

{

HAL_IncTick();

}

Maybe the core frequency is too low to execute the tick handler?

Do I need the system tick at all?  I think the HAL_ADC_DeInit uses it.

Can I slow the tick down to some slow value so it doesn't overwhelm the processor?

Am I even asking the right question?

    This topic has been closed for replies.

    1 reply

    Graduate II
    March 14, 2024

    Executing once every 65 cycles probably isn't going to end well. Would probably disable and find a different way to count milliseconds. Perhaps a TIM

    NormanAuthor
    Visitor II
    March 14, 2024

    Hope neither your Telsa nor DeLorean rust :)

    I agree that an interrupt every 65 cycles is not great.  I don't need the tick at all but many of the HAL functions seem to reference the tick.

    Since my last post, I found that changing the TimeBase source to TIM02 at least got me through the SystemClock_Config.

    But, other functions that use the tick are still not completing.

    How do I disable using the congurator?

    How do I tell all the HAL functions to use the TIM as count source?