cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F401RE external crystal HSE issue

AkshaySindal
Associate II

Hello,

I am using Nucleo-F401RE MB1136, want to run the board using the HSE, installed 8Mhz crystal on X3 with 22pf capacitors on C33 & C34 and 0 Ohm resistors on R35 & R37.

Using the CubeMx, configured the HSE pin as Crystal/Ceramic Resonator, set the clock in the Crystal Configuration for HSE as 8Mhz, tried both the ways, directly using HSE as System Clock and with using the PLL block.

Still not able to run the code as the code gets stuck in SystemClock_Config(void), no pulse is generated on the crystal.

Is there any step that i missed or some configuration, please guide me if possible. I am new into the Stm world. Provided the snippet of the CubeMx generated code.

Thank You

 

__weak HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef  *RCC_OscInitStruct)
{
  uint32_t tickstart;
  uint32_t pll_config;
  /* Check Null pointer */
  if (RCC_OscInitStruct == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_RCC_OSCILLATORTYPE(RCC_OscInitStruct->OscillatorType));
  /*------------------------------- HSE Configuration ------------------------*/
  if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE)
  {
    /* Check the parameters */
    assert_param(IS_RCC_HSE(RCC_OscInitStruct->HSEState));
    /* When the HSE is used as system clock or clock source for PLL in these cases HSE will not disabled */
    if ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_HSE) || \
        ((__HAL_RCC_GET_SYSCLK_SOURCE() == RCC_CFGR_SWS_PLL) && ((RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) == RCC_PLLCFGR_PLLSRC_HSE)))
    {
      if ((__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) != RESET) && (RCC_OscInitStruct->HSEState == RCC_HSE_OFF))
      {
        return HAL_ERROR;
      }
    }
    else
    {
      /* Set the new HSE configuration ---------------------------------------*/
      __HAL_RCC_HSE_CONFIG(RCC_OscInitStruct->HSEState);

      /* Check the HSE State */
      if ((RCC_OscInitStruct->HSEState) != RCC_HSE_OFF)
      {
        /* Get Start Tick */
        tickstart = HAL_GetTick();

        /* Wait till HSE is ready */
        while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET)
        {
          if ((HAL_GetTick() - tickstart) > HSE_TIMEOUT_VALUE)
          {
            return HAL_TIMEOUT;
          }
        }
      }

  

11 REPLIES 11

According to the board's schematics in this link, you need to remove SB50 (Solder bridge):

SofLit_0-1729171688993.png

So search for SB50 on the board and unsolder it.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

@SofLit wrote:

search for SB50 on the board and unsolder it.


@AkshaySindal you don't even have to search - the User Manual shows you where it is:

AndrewNeil_0-1730277562817.png

https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf#page=14