HAL_ChibiOS: fixed peripheral power-up on fmuv5
we need to do the powerup before we initialise the UARTs
This commit is contained in:
parent
409e857f6b
commit
0201893f7c
@ -154,6 +154,8 @@ static THD_FUNCTION(main_loop,arg)
|
||||
|
||||
ChibiOS::Shared_DMA::init();
|
||||
|
||||
peripheral_power_enable();
|
||||
|
||||
hal.uartA->begin(115200);
|
||||
|
||||
#ifdef HAL_SPI_CHECK_CLOCK_FREQ
|
||||
@ -177,8 +179,6 @@ static THD_FUNCTION(main_loop,arg)
|
||||
|
||||
schedulerInstance.hal_initialized();
|
||||
|
||||
peripheral_power_enable();
|
||||
|
||||
g_callbacks->setup();
|
||||
hal.scheduler->system_initialized();
|
||||
|
||||
|
@ -254,14 +254,24 @@ void set_fast_reboot(enum rtc_boot_magic v)
|
||||
|
||||
/*
|
||||
enable peripheral power if needed This is done late to prevent
|
||||
problems with RTS causing SiK radios to stay in the bootloader
|
||||
problems with CTS causing SiK radios to stay in the bootloader. A
|
||||
SiK radio will stay in the bootloader if CTS is held to GND on boot
|
||||
*/
|
||||
void peripheral_power_enable(void)
|
||||
{
|
||||
#if defined(HAL_GPIO_PIN_nVDD_5V_PERIPH_EN) || defined(HAL_GPIO_PIN_nVDD_5V_HIPOWER_EN)
|
||||
// we don't know what state the bootloader had the CTS pin in, so
|
||||
// wait here with it pulled up from the PAL table for enough time
|
||||
// for the radio to be definately powered down
|
||||
for (uint8_t i=0; i<100; i++) {
|
||||
// use a loop as this may be a 16 bit timer
|
||||
chThdSleep(MS2ST(1));
|
||||
}
|
||||
#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
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user