cancel
Showing results for 
Search instead for 
Did you mean: 

External Crystal not working on STM32L073Rz Nucleo Board.

Amir Chaudhary
Associate II

The Nucleo Board takes clock (8MHz) from ST- Link Programmer and we want to switch it to external (8MHz) crystal which is not working.

We programmed the RCC->CR register to 0X03030300U so that it sets to external crystal but it shows 0X03050305U ( HSEBYP, HSEON, HSI16RDYF, HSI16ON is set).

This is making the uC to operate on its internal clock.

Everytime the HSERDY bit is zero that says that the External clock is not stable.

We tried changing different external crystal's of 8MHz on the STM32L073RZ Nucleo Board and also changed different values of cap's (18pf, 20pf, 27pf, 33pf) but none of them worked.

Please guide.

9 REPLIES 9

BYPASS is not the mode you want for an external crystal ​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Amir Chaudhary
Associate II

No we are not using HSEBYP,

We are setting 0X03030300 which set the HSEON and clears HSEBYP.

Only issue is that the HSERDY bit is not set.

Sorry, I'm not going to decode the register level stuff on this.

Use the library examples, they are known to work.

Make sure all the other connections to the chip from the ST-LINK 8MHz source are removed.

Review the BOM for the parts/values used by ST.

Review the Crystal Oscillator App Note, and check the parts recommend, and computation for crystal load caps.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you for all your support.

All the connections including the resistors, caps of 20pF and 8MHz crystal are properly connected at its place.

Have done after reviewing the BOM and schematics from ST.

If any other info most welcome.

Thank you.

{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0];
 
  /* Enable HSE Oscillator and activate PLL with HSE as source
     PLLCLK = (8 * 12) / 3) = 32 MHz */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
  RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV3;
  HAL_RCC_OscConfig(&RCC_OscInitStruct);
}

Bring up the oscillator, ideally feed to MCO PA8 and scope there, or check if it starts directly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

We need the same 8Mhz Clock as the STlink programmer gives to the main microcontroller (STM32L073RZ).

Need to use only HSE only.

Ok, and does the code above start the crystal, or not?

If it does not you need to focus on the electrical issues.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

We were able to solve the issue using Keil IDE, but our complete code is in mbed OS and there the issue still persists.

If anyhow this issue is solved in mbed OS its done.

Then you'll need to review what that code is doing compared to the sequencing prescribed by ST for bringing up the clocks properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..