STM32L051R8Tx Clockswitch gives Timeout
Used FW_Package: 1.12.1
Debugger ST-LINK V2
IDE: STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-28 2:56 AM
Hello Community,
i have the strange behavior that the Clockswitch to HSE does not work in STM32L051.
__HAL_RCC_SYSCLK_CONFIG(RCC_ClkInitStruct->SYSCLKSource);
/* Get Start Tick */
tickstart = HAL_GetTick();
if(RCC_ClkInitStruct->SYSCLKSource == RCC_SYSCLKSOURCE_HSE)
{
while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_HSE)
{
if((HAL_GetTick() - tickstart ) > CLOCKSWITCH_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
I always hit the Timeout value due to RCC->CFGR->SW will never be set to "8".
"8" means External Highspeed Oscillator.
A check of the SFRs shows me that RCC->CFGR->SW has a width of 2Bits but i need at least the 3 Bits for value "8".
RCC->CR-> HSERDY and HSEON shows "1" as expected and is measure 8 MHz Oscillator Frequency switched On.
Thanks for all answers in advance
BR's
Martin
Solved! Go to Solution.
- Labels:
-
RCC
-
STM32L0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-28 5:46 AM
Failure found, was a Misstypo in SCM -> wrong µC in project.
Stay Healthy
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-28 3:44 AM
Additional Information: Understood the bitmasking for Value "8" and
Code Line
__HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS)))
We check HW and come back again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-28 5:46 AM
Failure found, was a Misstypo in SCM -> wrong µC in project.
Stay Healthy
Martin
