Last active
January 9, 2023 17:23
-
-
Save csrohit/f63ca5034f1960d0e49302959df65526 to your computer and use it in GitHub Desktop.
Supporting gist for clock configuration article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RCC->CFGR |= RCC_CFGR_PPRE1_2; | |
| RCC->CFGR |= RCC_CFGR_PLLXTPRE_HSE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // comments only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RCC->CFGR |= RCC_CFGR_SW_PLL; | |
| while (!(RCC->CFGR & RCC_CFGR_SWS_PLL)) | |
| ; | |
| // clock is ready @72MHZ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RCC->CR |= RCC_CR_HSEON; | |
| while (!(RCC->CR & RCC_CR_HSERDY)) | |
| ; | |
| // hse ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FLASH->ACR |= FLASH_ACR_LATENCY_2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RCC->CFGR |= RCC_CFGR_PLLSRC; | |
| RCC->CFGR |= RCC_CFGR_PLLMULL9; | |
| RCC->CR |= RCC_CR_PLLON; | |
| while (!(RCC->CR & RCC_CR_PLLRDY)) | |
| ; | |
| // PLL is ready |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment