Bootloader: do not configure clock on start, just minimum LL init. (#269)

* Bootloader: do not configure clock on start, just minimum LL init.
This commit is contained in:
あく 2020-12-18 20:51:08 +03:00 committed by GitHub
parent aa1a893d81
commit dde163fa61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 39 deletions

View File

@ -598,7 +598,7 @@ extern "C" void cc1101_workaround(void* p) {
true, true, true, false, true, false, true}; true, true, true, false, true, false, true};
for(uint8_t n = 0; n < 10; n++) { for(uint8_t n = 0; n < 10; n++) {
for(uint8_t i = 0; i < sizeof(SEQ)/sizeof(SEQ[0]); i++) { for(uint8_t i = 0; i < sizeof(SEQ) / sizeof(SEQ[0]); i++) {
if(SEQ[i]) { if(SEQ[i]) {
gpio_write(&cc1101_g0_gpio, false); gpio_write(&cc1101_g0_gpio, false);
delay_us(ONE_ON); delay_us(ONE_ON);

View File

@ -31,42 +31,8 @@
#define BOOT_USB_PIN (BOOT_USB_DM_PIN | BOOT_USB_DP_PIN) #define BOOT_USB_PIN (BOOT_USB_DM_PIN | BOOT_USB_DP_PIN)
void clock_init() { void clock_init() {
LL_FLASH_SetLatency(LL_FLASH_LATENCY_3); LL_Init1msTick(4000000);
LL_RCC_MSI_Enable(); LL_SetSystemCoreClock(4000000);
while(LL_RCC_MSI_IsReady() != 1) {
}
/* Main PLL configuration and activation */
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 32, LL_RCC_PLLR_DIV_2);
LL_RCC_PLL_Enable();
LL_RCC_PLL_EnableDomain_SYS();
while(LL_RCC_PLL_IsReady() != 1) {
}
/* Sysclk activation on the main PLL */
/* Set CPU1 prescaler*/
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
/* Set CPU2 prescaler*/
LL_C2_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_2);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) {
}
/* Set AHB SHARED prescaler*/
LL_RCC_SetAHB4Prescaler(LL_RCC_SYSCLK_DIV_1);
/* Set APB1 prescaler*/
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
/* Set APB2 prescaler*/
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
LL_Init1msTick(64000000);
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
LL_SetSystemCoreClock(64000000);
} }
void gpio_init() { void gpio_init() {
@ -119,7 +85,6 @@ void target_init() {
clock_init(); clock_init();
rtc_init(); rtc_init();
gpio_init(); gpio_init();
usb_wire_reset(); usb_wire_reset();
} }