AP_IOMCU: retry forcing IOMCU into bootloader multiple times

this fixes an issue where the update of IO firmware can fail
This commit is contained in:
Andrew Tridgell 2023-12-24 06:28:34 +11:00
parent 9fbf3b5bed
commit 865cffa5f2
1 changed files with 6 additions and 1 deletions

View File

@ -869,8 +869,13 @@ bool AP_IOMCU::check_crc(void)
DEV_PRINTF("IOMCU: CRC mismatch expected: 0x%X got: 0x%X\n", (unsigned)crc, (unsigned)io_crc); DEV_PRINTF("IOMCU: CRC mismatch expected: 0x%X got: 0x%X\n", (unsigned)crc, (unsigned)io_crc);
} }
// get IOMCU into the bootloader. We retry to maximise the chances
// of success
const uint16_t magic = REBOOT_BL_MAGIC; const uint16_t magic = REBOOT_BL_MAGIC;
for (uint8_t i=0; i<16; i++) {
write_registers(PAGE_SETUP, PAGE_REG_SETUP_REBOOT_BL, 1, &magic); write_registers(PAGE_SETUP, PAGE_REG_SETUP_REBOOT_BL, 1, &magic);
hal.scheduler->delay(1);
}
// avoid internal error on fw upload delay // avoid internal error on fw upload delay
last_reg_read_ms = 0; last_reg_read_ms = 0;