This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Application read the DFU Revision Number.

This thread mentions having the master read the DFU Revision Characteristic to determine the DFU revision. I've based my DFU and application off the dfu_dual_bank_ble_310_pca10028, and bel_app_hrs examples, respectively.

Both of these examples have DFU_REV_MAJOR, DFU_REV_MINOR and DFU_REVISION defined in their main.c files (they may not match), and use these to set the value of the DFU Revision Characteristic - which may be different if the application is running or if the DFU is running.

When my application is running the DFU_REVISION is based on what is defined in the main.c of the application code. After writing to the dfu control point, and switching to the DFU's code, DFU_REVISION is now is defined in the dfu's main.c. I do not want a "hard" definition of the DFU_REVISION in my main application. I want the application to read the DFU version from the DFU code.

How can I makethe application read the DFU version from the DFU, and not rely on the #define DFU_REV_MAJOR, DFU_REV_MINOR and DFU_REVISION in my application's main.c file?

Parents
  • Hi CCook,

    Please be noted that the DFU_REVISION in the application code is set as 0x01 (and is fixed as 0x01) to tell the DFU master that it's the application, not the DFU bootloader. And by that knows what to do to put the device in DFU mode.

    We may have different DFU_REVISION for DFU bootloader depends on the SDK version, but we will try to keep the DFU_REVISION of the application at 0x01.

    The DFU_REVISION mainly made for the DFU master (running on phone or PC) to know which bootloader version is running on the device.

    I assume that you want to know the bootloader version before you enter bootloader mode. You may have to modify the bootloader in order to do this. I am thinking of simply writing additional information to bootloader setting page on flash and then in your application you can read this information out.

    If it's what you wanted, could you let me know the reason of that ?

Reply
  • Hi CCook,

    Please be noted that the DFU_REVISION in the application code is set as 0x01 (and is fixed as 0x01) to tell the DFU master that it's the application, not the DFU bootloader. And by that knows what to do to put the device in DFU mode.

    We may have different DFU_REVISION for DFU bootloader depends on the SDK version, but we will try to keep the DFU_REVISION of the application at 0x01.

    The DFU_REVISION mainly made for the DFU master (running on phone or PC) to know which bootloader version is running on the device.

    I assume that you want to know the bootloader version before you enter bootloader mode. You may have to modify the bootloader in order to do this. I am thinking of simply writing additional information to bootloader setting page on flash and then in your application you can read this information out.

    If it's what you wanted, could you let me know the reason of that ?

Children
  • "I assume that you want to know the bootloader version before you enter bootloader mode. You may have to modify the bootloader in order to do this. I am thinking of simply writing additional information to bootloader setting page on flash and then in your application you can read this information out. If it's what you wanted, could you let me know the reason of that ? "
    Hung - This is exactly what I want to do. We have a custom iOS and Android application that connects to our BLE device. On connection it reads the version number of the DFU, Soft Device, and Application. If updates are available, or needed for any of them, the user is prompted to perform a firmware update. We would prefer not to have to start to the DFU to get the actual DFU version number. Updating the settings page should work, but I'm not sure how to accomplish this.

  • Hi Cook,

    The need for bootloader update is not that big, since it's pretty stable. We usually update the bootloader only when we update the softdevice that makes it not compatible with the bootloader.

    If you really want to have the bootloader version when in application mode, you can modify bootloader_settings_t struct, to add uint16_t bootloader_version in, for example. In the bootloader, you keep update the bootloader_version with the correct version when you save the bootloader setting (when calling bootloader_settings_save() ).

    Then in the application, you can read in flash at page BOOTLOADER_SETTINGS_ADDRESS (0x0003FC00), to read the bootloader_settings_t struct out.

Related