void systemInit(void) { checkForBootLoaderRequest(); SetSysClock(); // Configure NVIC preempt/priority groups NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING); // cache RCC->CSR value to use it in isMPUSoftreset() and others cachedRccCsrValue = RCC->CSR; /* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */ extern void *isr_vector_table_base; NVIC_SetVectorTable((uint32_t)&isr_vector_table_base, 0x0); RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, DISABLE); RCC_ClearFlag(); enableGPIOPowerUsageAndNoiseReductions(); // Init cycle counter cycleCounterInit(); memset(extiHandlerConfigs, 0x00, sizeof(extiHandlerConfigs)); // SysTick SysTick_Config(SystemCoreClock / 1000); }
void systemInit(void) { checkForBootLoaderRequest(); //SystemClock_Config(); // Configure NVIC preempt/priority groups HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITY_GROUPING); // cache RCC->CSR value to use it in isMPUSoftReset() and others cachedRccCsrValue = RCC->CSR; /* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */ //extern void *isr_vector_table_base; //NVIC_SetVectorTable((uint32_t)&isr_vector_table_base, 0x0); //__HAL_RCC_USB_OTG_FS_CLK_DISABLE; //RCC_ClearFlag(); enableGPIOPowerUsageAndNoiseReductions(); // Init cycle counter cycleCounterInit(); // SysTick //SysTick_Config(SystemCoreClock / 1000); HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); }
void systemInit(void) { checkForBootLoaderRequest(); SetSysClock(false); #ifdef CC3D /* Accounts for OP Bootloader, set the Vector Table base address as specified in .ld file */ extern void *isr_vector_table_base; NVIC_SetVectorTable((uint32_t)&isr_vector_table_base, 0x0); #endif // Configure NVIC preempt/priority groups NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING); // Turn on clocks for stuff we use RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); // cache RCC->CSR value to use it in isMPUSoftreset() and others cachedRccCsrValue = RCC->CSR; RCC_ClearFlag(); enableGPIOPowerUsageAndNoiseReductions(); // Set USART1 TX (PA9) to output and high state to prevent a rs232 break condition on reset. // See issue https://github.com/cleanflight/cleanflight/issues/1433 gpio_config_t gpio; gpio.mode = Mode_Out_PP; gpio.speed = Speed_2MHz; gpio.pin = Pin_9; digitalHi(GPIOA, gpio.pin); gpioInit(GPIOA, &gpio); // Turn off JTAG port 'cause we're using the GPIO for leds #define AFIO_MAPR_SWJ_CFG_NO_JTAG_SW (0x2 << 24) AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_NO_JTAG_SW; // Init cycle counter cycleCounterInit(); memset(extiHandlerConfigs, 0x00, sizeof(extiHandlerConfigs)); // SysTick SysTick_Config(SystemCoreClock / 1000); }
void systemInit(void) { checkForBootLoaderRequest(); // Enable FPU SCB->CPACR = (0x3 << (10 * 2)) | (0x3 << (11 * 2)); // Configure NVIC preempt/priority groups NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING); // cache RCC->CSR value to use it in isMPUSoftreset() and others cachedRccCsrValue = RCC->CSR; RCC_ClearFlag(); enableGPIOPowerUsageAndNoiseReductions(); memset(extiHandlerConfigs, 0x00, sizeof(extiHandlerConfigs)); // Pre-setup SysTick and system time - final setup is done in systemClockSetup systemTimekeepingSetup(); }
void systemInit(void) { checkForBootLoaderRequest(); // Enable FPU SCB->CPACR = (0x3 << (10 * 2)) | (0x3 << (11 * 2)); SetSysClock(); // Configure NVIC preempt/priority groups NVIC_PriorityGroupConfig(NVIC_PRIORITY_GROUPING); // cache RCC->CSR value to use it in isMPUSoftreset() and others cachedRccCsrValue = RCC->CSR; RCC_ClearFlag(); enableGPIOPowerUsageAndNoiseReductions(); // Init cycle counter cycleCounterInit(); memset(extiHandlerConfigs, 0x00, sizeof(extiHandlerConfigs)); // SysTick SysTick_Config(SystemCoreClock / 1000); }