2022-04-20 12:37 AM
HI i got a problèm on an stm32f0.after a reset the µC is at 8mhz but i'm only able to climb to 16mhz when i want to go to 48MHZ , did someone have idea of where does the problem come from.
the µc are not new because i work on protoboard and i cant change it.
void Setup_Init_Clocks()
{
RCC_DeInit();
RCC_HSICmd(ENABLE);
RCC_PLLConfig(RCC_PLLSource_HSI,6);//with that pll mult i must have 48mhz?
//RCC_PREDIV1Config(1);
RCC_PLLCmd(ENABLE);
//RCC_PREDIV1Config(1);
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
//RCC_USARTCLKConfig();definir si utile
RCC_ClocksTypeDef value;
RCC_GetClocksFreq(&value);
}
int main(void) {
Elevator_Data test_cab;
Setup_Init_Clocks();
F_Init_IO();
F_InitTimers();
u8_F_CrepINIT();
F_InitUSART1();
F_InputsRead(&test_cab);
F_LedsWrite(&test_cab);
thanks by advance
Solved! Go to Solution.
2022-04-20 01:56 AM
> i got a timer with a blinking led , whatever i do with the PLL multiplier i got the same result on the led
It may be the "library" automatically changing the values set in Timer's registers, as you change the system clock. Read out and check the RCC and the Timer registers' content for the different versions.
> and how do you change the flash latency?
JW
2022-04-20 01:11 AM
> but i'm only able to climb to 16mhz
What is this, SPL?
What is "climb"? What happens if you "climb" higher? How do you verify the system clock?
Are you or the "libraries" you are using aware of the fact that you have to change FLASH latency setting (set waitstates), if you want to go beyond certain system clock frequency?
JW
2022-04-20 01:19 AM
I'm french so i'm trying to be the more clear as possible ,
i use the stdperiph given by ST,
i got a timer with a blinking led , whatever i do with the PLL multiplier i got the same result on the led
and how do you change the flash latency?
is that this ?
2022-04-20 01:56 AM
> i got a timer with a blinking led , whatever i do with the PLL multiplier i got the same result on the led
It may be the "library" automatically changing the values set in Timer's registers, as you change the system clock. Read out and check the RCC and the Timer registers' content for the different versions.
> and how do you change the flash latency?
JW
2022-04-20 02:06 AM
I finaly succeed to set a 48Mhz clock but now the code seem work only in debug is latency can cause that problème?
i'm trying to change the latency to see if it work
2022-04-20 02:57 AM
OK i finaly found how to set the latency and that seem like to work
thank you for your help waclawek.jan ,have a nice day !
i post the code if someone need the solution :
void Setup_Init_Clocks()
{
FLASH->ACR = 1;
if ((RCC->CFGR & RCC_CFGR_SWS) == RCC_CFGR_SWS_PLL) /* (1) */
{
RCC->CFGR &= (uint32_t) (~RCC_CFGR_SW); /* (2) */
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_HSI) /* (3) */
{
/* For robust implementation, add here time-out management */
}
}
RCC->CR &= (uint32_t)(~RCC_CR_PLLON);/* (4) */
while((RCC->CR & RCC_CR_PLLRDY) != 0) /* (5) */
{
/* For robust implementation, add here time-out management */
}
RCC->CFGR = ((RCC->CFGR) & (~RCC_CFGR_PLLMUL)) | (RCC_CFGR_PLLMUL12); /* (6) */
RCC->CR |= RCC_CR_PLLON; /* (7) */
while((RCC->CR & RCC_CR_PLLRDY) == 0) /* (8) */
{
/* For robust implementation, add here time-out management */
}
RCC->CFGR |= (uint32_t) (RCC_CFGR_SW_PLL); /* (9) */
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL) /* (10) */
{
/* For robust implementation, add here time-out management */
}
RCC_ClocksTypeDef value;
RCC_GetClocksFreq(&value);
}