HAL_ChibiOS: delay peripheral power on for fmuv5

this should prevent SiK radios staying in the bootloader
This commit is contained in:
Andrew Tridgell 2018-07-11 15:11:36 +10:00
parent 0af97529ba
commit 63a0a4979c
4 changed files with 27 additions and 2 deletions

View File

@ -25,6 +25,7 @@
#include "shared_dma.h"
#include "sdcard.h"
#include "hwdef/common/usbcfg.h"
#include "hwdef/common/stm32_util.h"
#include <hwdef.h>
@ -176,6 +177,8 @@ static THD_FUNCTION(main_loop,arg)
schedulerInstance.hal_initialized();
peripheral_power_enable();
g_callbacks->setup();
hal.scheduler->system_initialized();

View File

@ -251,3 +251,17 @@ void set_fast_reboot(enum rtc_boot_magic v)
{
set_rtc_backup0(v);
}
/*
enable peripheral power if needed This is done late to prevent
problems with RTS causing SiK radios to stay in the bootloader
*/
void peripheral_power_enable(void)
{
#ifdef HAL_GPIO_PIN_nVDD_5V_PERIPH_EN
palWriteLine(HAL_GPIO_PIN_nVDD_5V_PERIPH_EN, 0);
#endif
#ifdef HAL_GPIO_PIN_nVDD_5V_HIPOWER_EN
palWriteLine(HAL_GPIO_PIN_nVDD_5V_HIPOWER_EN, 0);
#endif
}

View File

@ -64,6 +64,9 @@ enum rtc_boot_magic check_fast_reboot(void);
// set RTC register for a fast reboot
void set_fast_reboot(enum rtc_boot_magic v);
// enable peripheral power if needed
void peripheral_power_enable(void);
#ifdef __cplusplus
}

View File

@ -94,8 +94,13 @@ I2C_ORDER I2C3 I2C1 I2C2 I2C4
# enable pins
PE3 VDD_3V3_SENSORS_EN OUTPUT HIGH
PF12 nVDD_5V_HIPOWER_EN OUTPUT LOW
PG4 nVDD_5V_PERIPH_EN OUTPUT LOW
# start peripheral power off, then enable after init
# this prevents a problem with radios that use RTS for
# bootloader hold
PF12 nVDD_5V_HIPOWER_EN OUTPUT HIGH
PG4 nVDD_5V_PERIPH_EN OUTPUT HIGH
PG5 VDD_5V_RC_EN OUTPUT HIGH
PG6 VDD_5V_WIFI_EN OUTPUT HIGH
PG7 VDD_3V3_SD_CARD_EN OUTPUT HIGH