cancel
Showing results for 
Search instead for 
Did you mean: 

SystemClock_Config hangs

sde c.1
Senior II

it seems my project hangs at this line ?

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
 
 {
 
  Error_Handler();
 
 }

What could be wrong?

0693W00000GZ5EIQA1.png0693W00000GZ5FUQA1.png0693W00000GZ5FFQA1.png 

4 REPLIES 4
TDK
Guru

Is this a custom board or known good hardware? Seems like you have a problem with the LSE connection.

You can try increasing the timeout value (LSE_STARTUP_TIMEOUT) to tens of seconds to see if it helps.

Edit:

Also, "hangs" is ambiguous. It is expected that the LSE will take some time to become stable. Does it return successfully after a few seconds or does it fail and return HAL_TIMEOUT?

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

Its a custom board, i will show the schematic and PCB design.

increasing timeout does not help.

0693W00000GZDpfQAH.png0693W00000GZDpkQAH.pngAfter further investigation i see the Backup Domain Write Protection disabling goes in timeout.

Can't figure out why this is happening.

Any idea's?

/* Wait for Backup domain Write protection disable */
      tickstart = HAL_GetTick();
 
      while(HAL_IS_BIT_CLR(PWR->CR, PWR_CR_DBP))
      {
        if((HAL_GetTick() - tickstart) > RCC_DBP_TIMEOUT_VALUE)
        {
          return HAL_TIMEOUT;
        }
      }
    }

Is there a write to the DBP bit before the snippet you've posted?

Read out and check if RCC_APB1ENR.PWREN is set.

JW

There is a write to PWR_CR_DBP before the snipped i posted, but the bit refuses to set

yes PWREN bit is set 0693W00000GZF3ZQAX.png 

I notice that the external xtal is not running, (measure nothing on scope), does this have influence at that point of the initialisation?

Wondering why i dont measure anything, as this is a recommended part by STM. I have tried all "LSE drive capability settings"...