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

Read DFU-Version at runtime

Hi,

After updating the mesh-devices over DFU, we would like to read the version of the application present on the device.

Is there a way, to read this information at runtime?

We use Mesh SDK 3.1.0 and SDK 15.2 on a nRF52840

Regards

Gerry

Parents
  • Hello Gerry,

    If you look at the Mesh SDK_3.1.0\examples\examples\dfu example, this actually checks the current app_version in the fw_updated_event_is_for_me() function. 

    case NRF_MESH_DFU_TYPE_APPLICATION:
                return (p_evt->fw_outdated.current.application.app_id == p_evt->fw_outdated.transfer.id.application.app_id &&
                        p_evt->fw_outdated.current.application.company_id == p_evt->fw_outdated.transfer.id.application.company_id &&
                        p_evt->fw_outdated.current.application.app_version < p_evt->fw_outdated.transfer.id.application.app_version);

    The last line checks the current app_version vs the app_version in the new update.

    You may want to know the application version outside this event? (I don't know), but this information is fetched in nrf_mesh_dfu.c, inside the dfu_evt_handler() on line 373.

            case BL_EVT_TYPE_DFU_NEW_FW:
                {
                    __LOG(LOG_SRC_DFU, LOG_LEVEL_INFO, "\tNew firmware!\n");
                    nrf_mesh_evt_t evt;
                    evt.type = NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED_NO_AUTH;
                    evt.params.dfu.fw_outdated.transfer.dfu_type = p_evt->params.dfu.new_fw.fw_type;
                    evt.params.dfu.fw_outdated.transfer.id       = p_evt->params.dfu.new_fw.fwid;
                    if (get_curr_fwid(
                                p_evt->params.dfu.new_fw.fw_type,
                                &evt.params.dfu.fw_outdated.current) == NRF_SUCCESS)
                    {
                        event_handle(&evt);
                    }

    get_curr_fwid() reads out the application_version (and application ID and some other stuff).

    Best regards,

    Edvin

Reply
  • Hello Gerry,

    If you look at the Mesh SDK_3.1.0\examples\examples\dfu example, this actually checks the current app_version in the fw_updated_event_is_for_me() function. 

    case NRF_MESH_DFU_TYPE_APPLICATION:
                return (p_evt->fw_outdated.current.application.app_id == p_evt->fw_outdated.transfer.id.application.app_id &&
                        p_evt->fw_outdated.current.application.company_id == p_evt->fw_outdated.transfer.id.application.company_id &&
                        p_evt->fw_outdated.current.application.app_version < p_evt->fw_outdated.transfer.id.application.app_version);

    The last line checks the current app_version vs the app_version in the new update.

    You may want to know the application version outside this event? (I don't know), but this information is fetched in nrf_mesh_dfu.c, inside the dfu_evt_handler() on line 373.

            case BL_EVT_TYPE_DFU_NEW_FW:
                {
                    __LOG(LOG_SRC_DFU, LOG_LEVEL_INFO, "\tNew firmware!\n");
                    nrf_mesh_evt_t evt;
                    evt.type = NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED_NO_AUTH;
                    evt.params.dfu.fw_outdated.transfer.dfu_type = p_evt->params.dfu.new_fw.fw_type;
                    evt.params.dfu.fw_outdated.transfer.id       = p_evt->params.dfu.new_fw.fwid;
                    if (get_curr_fwid(
                                p_evt->params.dfu.new_fw.fw_type,
                                &evt.params.dfu.fw_outdated.current) == NRF_SUCCESS)
                    {
                        event_handle(&evt);
                    }

    get_curr_fwid() reads out the application_version (and application ID and some other stuff).

    Best regards,

    Edvin

Children
Related