From dde163fa61f798997e5ebee1d5a004e5604e16de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Fri, 18 Dec 2020 20:51:08 +0300 Subject: [PATCH] Bootloader: do not configure clock on start, just minimum LL init. (#269) * Bootloader: do not configure clock on start, just minimum LL init. --- .../cc1101-workaround/cc1101-workaround.cpp | 4 +- bootloader/targets/f4/target.c | 39 +------------------ 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/applications/cc1101-workaround/cc1101-workaround.cpp b/applications/cc1101-workaround/cc1101-workaround.cpp index 01f175f8..0f84deaf 100644 --- a/applications/cc1101-workaround/cc1101-workaround.cpp +++ b/applications/cc1101-workaround/cc1101-workaround.cpp @@ -598,7 +598,7 @@ extern "C" void cc1101_workaround(void* p) { true, true, true, false, true, false, true}; 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]) { gpio_write(&cc1101_g0_gpio, false); delay_us(ONE_ON); @@ -614,7 +614,7 @@ extern "C" void cc1101_workaround(void* p) { osDelay(4); } - + gpio_write(&cc1101_g0_gpio, false); } diff --git a/bootloader/targets/f4/target.c b/bootloader/targets/f4/target.c index d8d5a879..8fbfbd08 100644 --- a/bootloader/targets/f4/target.c +++ b/bootloader/targets/f4/target.c @@ -31,42 +31,8 @@ #define BOOT_USB_PIN (BOOT_USB_DM_PIN | BOOT_USB_DP_PIN) void clock_init() { - LL_FLASH_SetLatency(LL_FLASH_LATENCY_3); - LL_RCC_MSI_Enable(); - 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); + LL_Init1msTick(4000000); + LL_SetSystemCoreClock(4000000); } void gpio_init() { @@ -119,7 +85,6 @@ void target_init() { clock_init(); rtc_init(); gpio_init(); - usb_wire_reset(); }