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

mesh bootloader: accepting DFU with version lower than the request version

We have some devices out in the field with a mixture of application versions. In one particular case, we have device A on application version 10 and we have device B on application version 20. Both devices are near each other so once device A sees device B's FWID packet, it requests a DFU by sending out a DFU Ready packet with application version 20. However, we have a host that's capable of issuing mesh DFUs and it's trying to update device A to application version 15.

I was looking through the nRF5 Mesh Bootloader to see if it would work and I noticed it does some checks in the handle_state_packet() function that would prevent device A from accepting the DFU with application version 15, while it's requesting application version 20. In the code below, it looks like the ready_packet_matches_our_req() function, which is called in handle_state_packet(), checks to see if the incoming packet's version is equal to or higher than the version in its current request.

bool ready_packet_matches_our_req(dfu_packet_t* p_packet, dfu_type_t dfu_type_req, fwid_union_t* p_fwid_req)
{
    if (dfu_type_req != p_packet->payload.state.dfu_type &&
        dfu_type_req != DFU_TYPE_NONE)
    {
        return false;
    }

    if (tid_cache_has_entry(p_packet->payload.state.transaction_id))
    {
        return false;
    }
    return (fwid_union_id_cmp(&p_packet->payload.state.fwid,
                p_fwid_req,
                dfu_type_req)
            &&
            (fwid_union_version_cmp(&p_packet->payload.state.fwid,
                p_fwid_req,
                dfu_type_req) >= 0));
}

Is this the intended behavior? Or is the device expected to accept a DFU with a version lower than what it's asking for (but still higher than its current version)?

For your reference, I'm using the mesh bootloader from nRF Mesh v3.1.0.

Parents
  • Hi,

    Only accepting upgrades (not downgrades) is the expected default behavior.

    Or is the device expected to accept a DFU with a version lower than what it's asking for (but still higher than its current version)?

    I do not quite understand what you mean. The DFU target does not "ask for" any particular version. When the DFU source pushes out an upgrade, nodes with the DFU bootloader will check if the upgrade is for their application (checking application ID.) If application ID match and also the version is higher than the current application, it will act as DFU target (and DFU relay.) If it is a different application it will act only as DFU relay. As DFU target it will receive and accept the upgrade being pushed by the DFU source.

    Regards,
    Terje

Reply
  • Hi,

    Only accepting upgrades (not downgrades) is the expected default behavior.

    Or is the device expected to accept a DFU with a version lower than what it's asking for (but still higher than its current version)?

    I do not quite understand what you mean. The DFU target does not "ask for" any particular version. When the DFU source pushes out an upgrade, nodes with the DFU bootloader will check if the upgrade is for their application (checking application ID.) If application ID match and also the version is higher than the current application, it will act as DFU target (and DFU relay.) If it is a different application it will act only as DFU relay. As DFU target it will receive and accept the upgrade being pushed by the DFU source.

    Regards,
    Terje

Children
No Data
Related