cancel
Showing results for 
Search instead for 
Did you mean: 

Clock mismatch in template code for NUCLEO-L412RB-P?

Chris Rice
Associate III

Hi there, we are getting started with a NUCLEO-L412RB-P evaluation board, which has a stm32L412RBT6PU processor on it.

According to Section 9.7.1 of the user's guide (UM2206), the default clock is the LSE oscillator, which is "OSC 32khz clock supply."

However,in the cubeL4 code, \Projects\NUCLEO-L412RB-P\Templates_LL\SRc\main.c file, they have the code below, which suggests 8MHz.

Is this a mismatch? Out of the box, do I need to change either my nucleo board clock, or the 80000000 below, in order to get it to work properly? Or (probably more likely) is there something I don't understand, and what is that?

Thanks!

  /* 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);
  
  /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
  LL_SetSystemCoreClock(80000000);

2 REPLIES 2

That's a misunderstanding.

UM2206 in 9.7.1 - in a clumsy way - says, that for the 32kHz (LSE, to be used mainly as RTC input), you have several jumper options, and the default one of them is using the 32kHz crystal.

In 9.7.2 it says - again quite clumsily - that for the high-speed clock input (HSE), there is nothing connected externally by default, so as primary source for the system clock, you are supposed to run out of HSI (and that is then geared up to 80MHz by PLL).

JW

Chris Rice
Associate III

Oh I see now Jan, thanks very much!