cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L05xx HSI problem with VDD = 1.8v

Rook.Malcolm
Associate II
Posted on October 10, 2016 at 14:08

I have a STM32L051K8T6 which I am running from a 1.8v supply to interface with a Quectel UG95 modem.  Project produced with STM32CubeMX. Code is compiled with Keil uVision 5.21a.

The firmware continually reboots about every 5 seconds (no watchdog implemented).  Debugging with Keil reveals that SystemClock_Config is very slow completing and that after completion HCLK frequency is 2MHz.  I take this to indicate that HSI did not start and the system has substituted the MSI clock.

Voltage scaling is set to Scale2 and SYSCLK is configured for a frequency of 8MHz

This is the code

void SystemClock_Config(void)

{

  RCC_OscInitTypeDef RCC_OscInitStruct;

  RCC_ClkInitTypeDef RCC_ClkInitStruct;

  RCC_PeriphCLKInitTypeDef PeriphClkInit;

      HAL_PWREx_EnableUltraLowPower();

 

  /* Enable the fast wake up from Ultra low power mode */

  HAL_PWREx_EnableFastWakeUp();

  /* Select HSI as system clock source after Wake Up from Stop mode */

  __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_StopWakeUpClock_HSI);

  __HAL_RCC_PWR_CLK_ENABLE();

  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);

  HAL_PWREx_DisableLowPowerRunMode();

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSE;

  RCC_OscInitStruct.LSEState = RCC_LSE_ON;

  RCC_OscInitStruct.HSIState = RCC_HSI_DIV4;

  RCC_OscInitStruct.HSICalibrationValue = 16;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_8;

  RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_4;

  HAL_RCC_OscConfig(&RCC_OscInitStruct);

  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1);

  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2|RCC_PERIPHCLK_RTC;

  PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;

  PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;

  PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;

  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);

  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

    HAL_NVIC_EnableIRQ(SysTick_IRQn);

}

I have checked STM32L0xx_hal_conf.h and this shows VDD_VALUE as 1800mV.  The actual supply voltage is 1.803V.

What have I missed out or done wrong?

The original prototype used a STM32L051K8T7 which is the same processor but with extended operating temperature range and this works.  I am assuming that it was a little more tolerant of the low voltage.

#hsi #stm32l05xx #1.8v
1 REPLY 1
Posted on October 10, 2016 at 17:49

Review what is happening to the NRST line, and the power rail.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..