Skip to content

Commit

Permalink
AP_IOMCU: retry forcing IOMCU into bootloader multiple times
Browse files Browse the repository at this point in the history
this fixes an issue where the update of IO firmware can fail
  • Loading branch information
tridge committed May 30, 2024
1 parent ec2696a commit 5ef3a36
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/AP_IOMCU/AP_IOMCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

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

// avoid internal error on fw upload delay
last_reg_read_ms = 0;
Expand Down

0 comments on commit 5ef3a36

Please sign in to comment.