Enable OTA DFU mode

Posted on
  • Hi,

    I just wanted to know if there is a possibility to that I can enable OTA DFU using just a Javascript?

    My scenario is that o do not have GPIO reach to enable DFU via hardware. So looking a softwares way to upgrade firmware using BLE.

    I am using nrf51822 based fitness tracker, which has very old SDK 9/10 maybe with softdevice S110. I am planning to upgrade softdevice, bootloader to S130, as Esprunio supports S130 onwards.

    Abhinav

  • Well, you have at least button there which is one GPIO for this. Anyway, yes it is possible, it depends on bootloader code, espruino bootloader by default requires holding some button but you can disable it in your own bootloader build. Typically this is done by setting some value in GPREGRET nrf register (which survives reset) and then performing soft reset. Then in bootloader you check this value and decide.

    Requiring some interaction is there for safety so nobody can reflash your device remotely without confirmation. So if you disable this just beware and protect espruino console so it is not accessible to everyone.

    The current way to switch to bootloader is a bit tricky with timing and there is no explicit method to switch to bootloader. I think better would be to allow switching to bootloader programatically but then there could be button confirmation before accepting the firmware (e.g. if you do not hold button while sending dfu zip it would fail). Safety would be same but you could invoke update procedure in deterministic way without user needing to hold button with precise timing while calling E.reboot()

  • I should also add that since you're using a nrf51822 there's really very little room available to fit in a bootloader and espruino - the micro:bit build overwrites the bootloader completely AFAIK to get a bit more space.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Enable OTA DFU mode

Posted by Avatar for Abhigkar @Abhigkar

Actions