我的硬件是STM32L152ZD,现在的状态是通过跟踪,程序一直运行在启动文件中。即启动文件中调用SystemInit (void),SystemInit (void)中又调用SetSysClock(void)。现在问题是 程序一直在do---wile()中循环,应该是在等待HSE稳定吧。资料上不是说STM32L1XX系列上电默认时钟就是HSI吗?附上SetSysClock(void)函数片段。库是V1.3.1.。。
先谢谢大家了
static void SetSysClock(void)
{
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/
/* Enable HSE */
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
if ((RCC->CR & RCC_CR_HSERDY) != RESET)
{
HSEStatus = (uint32_t)0x01;
}
else
{
HSEStatus = (uint32_t)0x00;
}
if (HSEStatus == (uint32_t)0x01)