5 years, 4 months ago.

External Crystal not working on STM32L073Rz Nucleo Board.

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.

1 Answer

5 years, 4 months ago.

I don't have this board so can't test it. In general terms though, if you need to configure the clock you might want to download STM32CubeMX configurator and setup a new project for your micro. There is a nice clock configuration screen that lets you play with all the settings so you can see exactly how all your clocks will be setup. As you dig into mbed's HAL layers it makes it much easier to follow.

It looks like that target is setup in mbed build system with the option to specify external crystal. I would try that first before messing with registers.

https://os.mbed.com/teams/ST/wiki/Automatic-clock-configuration

In the projects mbed_app.json file include:

  "target_overrides": { 
        "NUCLEO_L073RZ": {
               "target.clock_source": "USE_PLL_HSE_XTAL"
               }
        }

If that doesn't work, then I would dig into the clock initialization code for that target.

https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c

On the board there are also often resistors between oscillator pins and micro osc pins. Ensure these are populated with 0ohm jumpers. It's possible the connection is open by default.