From 5daee639223cf0da0e994172c4f2a13d8309a3ed Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Fri, 8 Nov 2019 20:00:31 +0100 Subject: [PATCH] PMU flash issue on Horus --- radio/src/io/frsky_firmware_update.cpp | 7 ++++++- radio/src/targets/horus/telemetry_driver.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/radio/src/io/frsky_firmware_update.cpp b/radio/src/io/frsky_firmware_update.cpp index d8a8933e9..c42a0d071 100644 --- a/radio/src/io/frsky_firmware_update.cpp +++ b/radio/src/io/frsky_firmware_update.cpp @@ -549,7 +549,7 @@ const char * FrskyChipFirmwareUpdate::waitAnswer(uint8_t & status) uint8_t buffer[12]; for (uint8_t i = 0; i < sizeof(buffer); i++) { uint32_t retry = 0; - while(1) { + while (true) { if (telemetryGetByte(&buffer[i])) { if ((i == 0 && buffer[0] != 0x7F) || (i == 1 && buffer[1] != 0xFE) || @@ -572,6 +572,10 @@ const char * FrskyChipFirmwareUpdate::waitAnswer(uint8_t & status) const char * FrskyChipFirmwareUpdate::startBootloader() { + sportSendByte(0x03); + RTOS_WAIT_MS(20); + sportSendByte(0x02); + RTOS_WAIT_MS(20); sportSendByte(0x01); for (uint8_t i = 0; i < 30; i++) @@ -582,6 +586,7 @@ const char * FrskyChipFirmwareUpdate::startBootloader() sportSendByte(0x7F); } + RTOS_WAIT_MS(20); sportSendByte(0xFA); /*for (uint8_t i=0; i < 30; i++) diff --git a/radio/src/targets/horus/telemetry_driver.cpp b/radio/src/targets/horus/telemetry_driver.cpp index fe143cfe2..ecd73b6ab 100644 --- a/radio/src/targets/horus/telemetry_driver.cpp +++ b/radio/src/targets/horus/telemetry_driver.cpp @@ -228,8 +228,14 @@ void telemetryPortSetDirectionOutput() TELEMETRY_USART->CR1 &= ~USART_CR1_RE; // turn off receiver } +void sportWaitTransmissionComplete() +{ + while (!(TELEMETRY_USART->SR & USART_SR_TC)); +} + void telemetryPortSetDirectionInput() { + sportWaitTransmissionComplete(); TELEMETRY_DIR_GPIO->BSRRH = TELEMETRY_DIR_GPIO_PIN; // output disable TELEMETRY_USART->CR1 |= USART_CR1_RE; // turn on receiver } -- 2.11.4.GIT