cancel
Showing results for 
Search instead for 
Did you mean: 

RTC can't work because PLL already use

starlin lin
Associate II
Posted on July 17, 2017 at 07:46

Dear Sir:

I had reference the PWR_STANDBY_RTC sample code form STM32Cube_FW_L4_V1.8.0

This sample code are work well and wake up about 30 second,

but after move to my code get return fail at

if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) form 

SystemClock_Config()

void SystemClock_Config(void)

{

......

RCC_OscInitStruct.PLL.PLLR = 2;

RCC_OscInitStruct.PLL.PLLP = 7;

RCC_OscInitStruct.PLL.PLLQ = 4;

if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

// return here.

while(1);

}

after check, find is because PLL already used?

/* Check if the PLL is used as system clock or not */

if(__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL)

{

.......

else

{

return HAL_ERROR;

}

I have reference this web say need turn off some content of 

SystemInit()

https://www.mianbaoban.cn/blog/post/45024

 

but still don't work, then how to use PLL and let SystemClock_Config?

Thx for your answer.

2 REPLIES 2
Posted on July 17, 2017 at 11:37

Hello

Normaly  after reset (wkup reset after stby mode) the MSI is the default clock source .

check the  standby flag  after reset to see if the mc was in StandBy Mode.

__HAL_PWR_GET_FLAG(PWR_FLAG_SB);

Clear this flag  after read it.

Posted on July 17, 2017 at 11:49

thx for reply.

at the sample code,

int main(void)

{

HAL_Init();

SystemClock_Config();

BSP_LED_Init(LED2);

RTC_Config();

SystemPower_Config();

if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)

{

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

}

.....

I do the same thing, but return error from 

SystemClock_Config();

I have try move clear sb flag to up then SystemClock_Config(), but get same result.

BTW, my project is base on zephyr RTOS.