diff --git a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp index 90010c956..0e4b03799 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp +++ b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp @@ -209,9 +209,8 @@ int main() RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | BACKLIGHT_RCC_APB2Periph | RCC_APB2Periph_SYSCFG, ENABLE); - keysInit(); pwrInit(); - pwrOff(); + keysInit(); #if defined(PCBHORUS) // wait a bit for the inputs to stabilize... diff --git a/radio/src/targets/horus/pwr_driver.cpp b/radio/src/targets/horus/pwr_driver.cpp index 0a4ad4846..2bb89ddbb 100644 --- a/radio/src/targets/horus/pwr_driver.cpp +++ b/radio/src/targets/horus/pwr_driver.cpp @@ -18,7 +18,6 @@ * GNU General Public License for more details. */ -#include "pwr.h" #include "board.h" void pwrInit() @@ -67,12 +66,12 @@ void pwrInit() // TRAINER DETECT PIN GPIO_InitStructure.GPIO_Pin = TRAINER_DETECT_GPIO_PIN; GPIO_Init(TRAINER_DETECT_GPIO, &GPIO_InitStructure); - - pwrOn(); } void pwrOn() { + // we keep the init of the PIN to have pwrOn as quick as possible + GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = PWR_ON_GPIO_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; diff --git a/radio/src/targets/taranis/pwr_driver.cpp b/radio/src/targets/taranis/pwr_driver.cpp index 757a6ef06..997937d9f 100644 --- a/radio/src/targets/taranis/pwr_driver.cpp +++ b/radio/src/targets/taranis/pwr_driver.cpp @@ -75,6 +75,16 @@ void pwrInit() void pwrOn() { + // we keep the init of the PIN to have pwrOn as quick as possible + + GPIO_InitTypeDef GPIO_InitStructure; + GPIO_InitStructure.GPIO_Pin = PWR_ON_GPIO_PIN; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + GPIO_Init(PWR_ON_GPIO, &GPIO_InitStructure); + GPIO_SetBits(PWR_ON_GPIO, PWR_ON_GPIO_PIN); } diff --git a/radio/src/targets/taranis/startup_stm32f40_41xxx.s b/radio/src/targets/taranis/startup_stm32f40_41xxx.s index 25fd9cf8c..95336855c 100644 --- a/radio/src/targets/taranis/startup_stm32f40_41xxx.s +++ b/radio/src/targets/taranis/startup_stm32f40_41xxx.s @@ -71,7 +71,9 @@ defined in linker script */ .type Reset_Handler, %function Reset_Handler: -/* Copy the data segment initializers from flash to SRAM */ + bl pwrResetHandler /*jump to WDT reset handler where soft power control pin is turned on as soon as possible */ + +/* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit @@ -111,8 +113,10 @@ LoopPaintMainStack: /* Call the clock system intitialization function.*/ bl SystemInit + /* Call C++ constructors for static objects */ - bl __libc_init_array + bl __libc_init_array + /* Call the application's entry point.*/ bl main bx lr