Skip to content

Commit 865cffa

Browse files
committed
AP_IOMCU: retry forcing IOMCU into bootloader multiple times
this fixes an issue where the update of IO firmware can fail
1 parent 9fbf3b5 commit 865cffa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libraries/AP_IOMCU/AP_IOMCU.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,13 @@ bool AP_IOMCU::check_crc(void)
869869
DEV_PRINTF("IOMCU: CRC mismatch expected: 0x%X got: 0x%X\n", (unsigned)crc, (unsigned)io_crc);
870870
}
871871

872+
// get IOMCU into the bootloader. We retry to maximise the chances
873+
// of success
872874
const uint16_t magic = REBOOT_BL_MAGIC;
873-
write_registers(PAGE_SETUP, PAGE_REG_SETUP_REBOOT_BL, 1, &magic);
875+
for (uint8_t i=0; i<16; i++) {
876+
write_registers(PAGE_SETUP, PAGE_REG_SETUP_REBOOT_BL, 1, &magic);
877+
hal.scheduler->delay(1);
878+
}
874879

875880
// avoid internal error on fw upload delay
876881
last_reg_read_ms = 0;

0 commit comments

Comments
 (0)