cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L552 Nucleo board: HSE error

krook
Associate II

Hi, I am trying to program a STM32L552ZEQ to use HSE instead of the default clock, but I am doing something wrong.

I attach the reference manual, as well as the user manual for my specific board. In the user manual, on page 24, it is stated that there is a HSE with 16 MHz clock frequency. I try to enable this by setting the HSEBYP and HSEON bits in `RCC->CR`, like so

```

RCC->CR |= RCC_CR_HSEBYP_Msk | RCC_CR_HSEON_Msk;
while(!(RCC->CR & RCC_CR_HSERDY_Msk));

```

Using GDB I observe the change to the register value happening as expected. After setting it, I am waiting for the hardware to set the HSERDY bit, indicating that everything went OK. But this bit is never set. I never seem to get out of this while-loop. I observe the bit not being set using e.g. GDB.

I looked at the reference manual and saw that MCO is fed to OSC_IN, which seems correct.

diagr.png

I then thought that it appears as if the MCO can be connected to several different sources, one of which being the HSE. I look at the reference manual, and find this

Screenshot from 2024-10-10 16-02-41.pngScreenshot from 2024-10-10 16-02-28.png

I modify my code to configure MCOSEL to have the value `0100`, to indicate that we should output the HSE to the MCO pin. I am using the CMSIS header files to access the correct addresses, and it seems as if the define for MCOSEL_2 carries the right value (4).

```

// the define is in the CMSIS header-file, but I paste it here for clarity

#define RCC_CFGR_MCOSEL_2 (0x4UL << RCC_CFGR_MCOSEL_Pos) /*!< 0x04000000 */
RCC->CFGR |= RCC_CFGR_MCOSEL_2;
```
This seems to make no difference at all, and I am now a bit unsure of how to progress.
 
Thanks in advance for any tips that might make me able to figure this out.
13 REPLIES 13

ST does not connect the MCO on some Nucleos such as L4 and L5, likely to allow lowest possible power consumption.

I am sure that I can find a colleague at work to help me solder. I can see the empty hole for PH0, e.g., but it is not clear to me from reading the user manual from where I can fetch ST-LINK MCO. What physical modifications do I need to do? I would love to learn how I can decode this from the two documents.

Thanks,

Robert


@krook wrote:

 it is not clear to me from reading the user manual from where I can fetch ST-LINK MCO. What physical modifications do I need to do?


From the extract @Chris21 posted, these are the settings you need:

AndrewNeil_0-1728579332922.png

"Off" means that there is no connection across the solder bridge - the bridge is open;

"On" means that there is a connection across the solder bridge - the bridge is closed.

(look like they forgot that this is just a solder bridge and not a jumper link - where the jumper would be literally on the pins, or off them)

 

PS:

https://community.st.com/t5/stm32-mcus-products/docmentation-of-solder-bridges/m-p/689362

Where ST's default SB is On, you will find a zero ohm resistor across the bridge; these can be a little annoying to remove unless you have good soldering equipment / skills. 

Here they say to remove SB142, but it looks like that may not really be necessary.