cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WBA 32MHz HSE. Can't Initialize HSE

Pablo04
Associate

Hi,

I made a custom PCB with a STM32WBA54CGU6 to act as a Bluetooth LE Audio transmitter. This was going to be first "real" PCB since before I have only made much simpler designs (I know I was very ambitious). For the HSE, I used this document to decide on the NX1612SA crystal oscillator. 

The problem I am facing is that I can't seem to get passed the SystemClock_Config() function call, more specifically, the HAL_RCC_OscConfig() function returns HAL_TIMEOUT in this part indicating that the HSE is not getting ready.

        /* Wait till HSE is ready */
        while (READ_BIT(RCC->CR, RCC_CR_HSERDY) == 0U)
        {
          if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
          {
            return HAL_TIMEOUT;
          }
        }
      }

 I know I have to trim the clock using the registers on the STM32 but I was unable to find how the value in the register maps to a specific capacitance. This led me trying every single possible value (0-63) but that made no difference. I have already resoldered a new crystal and a new STM32 so I am now believing the I have a layout issue in my PCB that's causing the crystal to not start. 

Pablo04_0-1748819756112.png

(The four pad footprint is the crystal connected to pins 40 and 41)

This is my layout and after some more research, I now think that I needed a ground "ring" and more vias returning to the ground plane around the crystal as recommended in this document. 

 

I also have confirmed the proper settings for the HSE setting to "Crystal/Ceramic Resonator" and to set the HSE clock to 32MHz in the Clock Configuration Tab of STM32CubeIDE.

 

I am asking for confirmation on my suspicions or ideas on other things I could test to get this to work. 

 

Thanks in advance.

1 REPLY 1
AScha.3
Super User

Hi,

your crystal + layout looks ok.

>but I was unable to find how the value in the register maps to a specific capacitance

-> Refer to AN5042 for the HSE trimming procedure.

ok, just see rm :

AScha3_0-1748930062758.png

(I dont have this chip...) Is there nothing to set the HSE in Cube ?

If not : set a value with "average" values , i would try : 

- before the start of the hse

- unlock register

AScha3_1-1748930419194.png

- write 0x2FA0   (just guessing...try. or 2FF0, max drive) to RCC_HSECR

-> read AN2867 “Oscillator design guide for STM8S, STM8A and STM32

+ all voltage levels ok ? smps ...working?

 

 

If you feel a post has answered your question, please click "Accept as Solution".