2020-02-12 01:21 AM
Hi.
I want to use my MCU at its max Speed.
I am using STM32F103C8T6( Blue Pill ).
Can any one Provide good resource?
can anyone Provide source code for this ?
Can anyone tell me about that in my Controller Why are we using RCC_CFGR and RCC_CFGR2?
What is the meaning of PLL, PLL2 and PLL3 and Differnece between them ?
Solved! Go to Solution.
2020-02-12 01:33 AM
The best resource is chapter 7 of the reference manual, all RCC register are thoroughly explained.
STM32F103C8T6 has neither PLL2 nor PLL3, there are present on STM32F105/STM32F107 only.
2020-02-12 01:33 AM
The best resource is chapter 7 of the reference manual, all RCC register are thoroughly explained.
STM32F103C8T6 has neither PLL2 nor PLL3, there are present on STM32F105/STM32F107 only.
2020-02-12 02:43 AM
Indeed reference manual is right source. but i am not that smart.
I write a code with my little knowledge. Can anyone examine my code.
void set_RCC_HSI_Clock_APB2_20MHz()
{
// 1: #HSI oscillator clock / 2 selected as PLL input clock when PLL is disable
RCC->CFGR |= HSI_DIV_2;
// 2:
RCC->CFGR |= PLLMULL_x_10;// setting PLL for 40 MHz
// 3: APB2 presclaer AHB Div by 2 which means 40/2 = 20 MHz
RCC->CFGR |= 1<<13;
// 4: set HSI as clock
RCC->CR |= RCC_CR_HSION;
// 5: wait for HSI to be ready
while(!(RCC->CR & RCC_CR_HSIRDY));
// 6: Enable PLL
RCC->CR |= PLL_ON;
// 7: check PLL ready Flag
while(!(RCC->CR & PLL_RDY_FLAG ));
// 8: select PLL as system Clock
RCC->CFGR |= 0x00000002;
// 9: wait for PLL to be ready
while( !( RCC->CFGR & 0x00000008 ) );
// 10: AHB preScaler div by 1
RCC->CFGR |= 0x0 << 7;
}
2020-03-17 03:05 AM
Compile your code with debug symbbols enables, step through this code and decode the RCC register values with the refenece manual. With some reasoning, you will find what is missing or what is wrong.
Otherwise, you can find a lot of bare-bones examles how to set 72 MHz on the net.
2020-03-17 03:39 AM
Thanks Uwe Bonnes
I have completed this task.
At that time I don't know about bare metal programming and I found it very difficult to understand. Now I love it.:beaming_face_with_smiling_eyes:
2020-03-18 02:41 AM
And when you see the performance and size of the code... :)
At least someone directed into right direction. The ultimate goal is to make your own high-level libraries which are implemented with register level code.