Skip to content

Commit 8aee443

Browse files
julianoesLorenzMeier
authored andcommitted
px4io: set safety on before going into bootloader (#4860)
Sometimes when flashing new firmware, the IO update fails because safety is off. In this case, we should set safety on first before putting the IO board into bootloader mode.
1 parent 8524547 commit 8aee443

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/drivers/px4io/px4io.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,12 @@ PX4IO::init()
699699
// be due to mismatched firmware versions and we want
700700
// the startup script to be able to load a new IO
701701
// firmware
702+
703+
// If IO has already safety off it won't accept going into bootloader mode,
704+
// therefore we need to set safety on first.
705+
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_ON, PX4IO_FORCE_SAFETY_MAGIC);
706+
707+
// Now the reboot into bootloader mode should succeed.
702708
io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_REBOOT_BL, PX4IO_REBOOT_BL_MAGIC);
703709
return -1;
704710
}

0 commit comments

Comments
 (0)