diff --git a/firmware/config/boards/proteus/board_configuration.cpp b/firmware/config/boards/proteus/board_configuration.cpp index 1d086be2c6..f054007315 100644 --- a/firmware/config/boards/proteus/board_configuration.cpp +++ b/firmware/config/boards/proteus/board_configuration.cpp @@ -217,15 +217,15 @@ void setBoardDefaultConfiguration() { void boardPrepareForStop() { #ifdef STM32F7XX // enable EXTI on PD0 - CAN RX pin - palSetPadMode(GPIOD, 0, PAL_MODE_INPUT); - palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE); + palSetPadMode(GPIOD, 0, PAL_MODE_INPUT); //Select Pin 0 on D Port - PD0, CAN RX as input + palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE); // Set PD0 to interrupt on rising edge #endif #ifdef STM32F4XX // enable EXTI on PA0 - The only WKUP pin F4 has. PWR->CR |= PWR_CR_CWUF; //Clear Wakeup Pin flag for PA0 - palSetPadMode(GPIOA, 0, PAL_MODE_INPUT); - palEnableLineEvent(PAL_LINE(GPIOA, 0), PAL_EVENT_MODE_RISING_EDGE); + palSetPadMode(GPIOA, 0, PAL_MODE_INPUT); //Select Pin 0 on D Port - PA0, Wkup + palEnableLineEvent(PAL_LINE(GPIOA, 0), PAL_EVENT_MODE_RISING_EDGE); // Set PA0 to interrupt on rising edge #endif } diff --git a/firmware/hw_layer/ports/stm32/stm32f4/mpu_util.cpp b/firmware/hw_layer/ports/stm32/stm32f4/mpu_util.cpp index 7f0ceeffdd..2810b62f5c 100644 --- a/firmware/hw_layer/ports/stm32/stm32f4/mpu_util.cpp +++ b/firmware/hw_layer/ports/stm32/stm32f4/mpu_util.cpp @@ -30,7 +30,11 @@ uintptr_t getFlashAddrFirstCopy() { uintptr_t getFlashAddrSecondCopy() { return 0x080C0000; } - +/* +STOP mode for F7 is needed for wakeup from multiple EXTI pins. For example PD0, which is CAN rx. +However, for F40X & F42X this may be useless. STOP in itself eats more current than standby. +With F4 only having PA0 available for wakeup, this negates its need. +*/ void stm32_stop() { SysTick->CTRL = 0; SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; @@ -45,7 +49,7 @@ void stm32_stop() { boardPrepareForStop(); PWR->CR &= ~PWR_CR_PDDS; // cleared PDDS means stop mode (not standby) PWR->CR |= PWR_CR_FPDS; // turn off flash in stop mode - #ifdef STM32F429xx + #ifdef STM32F429xx //F40X Does not have these regulators available. PWR->CR |= PWR_CR_UDEN; // regulator underdrive in stop mode * PWR->CR |= PWR_CR_LPUDS; // low power regulator in under drive mode #endif @@ -59,7 +63,10 @@ void stm32_stop() { // Lastly, reboot NVIC_SystemReset(); } - +/* +Standby for both F4 & F7 works perfectly, with very little curent consumption. Downside is that theres a limited amount of pins that can wakeup F7, and only PA0 for F4XX. +Cannot be used for CAN wakeup without hardware modificatinos. +*/ void stm32_standby() { SysTick->CTRL = 0; SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; diff --git a/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp b/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp index 2b9fe19e86..08018d23a9 100644 --- a/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp +++ b/firmware/hw_layer/ports/stm32/stm32f7/mpu_util.cpp @@ -174,7 +174,11 @@ void sys_dual_bank(void) { */ } - +/* +STOP mode for F7 is needed for wakeup from multiple EXTI pins. For example PD0, which is CAN rx. +However, for F40X & F42X this may be useless. STOP in itself eats more current than standby. +With F4 only having PA0 available for wakeup, this negates its need. +*/ void stm32_stop() { SysTick->CTRL = 0; SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; @@ -202,7 +206,10 @@ void stm32_stop() { // Lastly, reboot NVIC_SystemReset(); } - +/* +Standby for both F4 & F7 works perfectly, with very little curent consumption. Downside is that theres a limited amount of pins that can wakeup F7, and only PA0 for F4XX. +Cannot be used for CAN wakeup without hardware modificatinos. +*/ void stm32_standby() { SysTick->CTRL = 0; SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;