cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_F103VE RCC_CR write issue

benfang2002
Associate
Posted on October 17, 2015 at 11:05

I am working on a project using internal clock though PLL as system clock,here is the issue:

1.HSI is 8MHz.

2.System is programmed to wake and sleep in 1 second period (Stop mode, using WFI), which is waked by RTC alarm.

3.Every time,when system is wakened, system calls function ''SetSysClock'' to setup HSI through PLL as system clock, and then do the job.

4.The problem is: After 512 seconds (512 times sleep and wake), system is down fault without any cause, and any reset both hardware and software are uneffective.

I tracked the program to the line  ''RCC->CR |= ((uint32_t)RCC_CR_HSEON)''

It seems after this line is called 512 times, the ''RCC_CR_HSERDY'' bit is set, but the system does not even has a external crystal clock at all.

I commented ''RCC->CR |= ((uint32_t)RCC_CR_HSEON)'', system works fine.

I already checked every erra sheet, it does not give any helpful info.

Could somebody helps me out?

   

#stm32f1-clock
2 REPLIES 2
Posted on October 17, 2015 at 14:55

Well if your board doesn't have an HSE, then you need to tailor the system_stm32f1xx.c to reflect your design choices.

There is no reason for enabling HSE, or waiting for it to come ready.

Are you doing anything with the PC13,14, and 15?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
benfang2002
Associate
Posted on October 19, 2015 at 04:36

This whole problem has this background:

1. The system uses HSE = 8MHZ, when it is running.

2. However, some one made a terrible mistake, the cap for crystal are 100nF for both.

3. It results the system has to use HSI for sysclk (which is the setsysclk function ''else loop'').

4. It is all for fail safe or fail work mode.

5. Even in fail Work mode, the system should work fine.

7. If the system is not in sleep_and_wake mode, it works fine.

8. If the HSE on operation is commented, it works fine.