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

Mesh DFU dfu_cmd_handler_set always failing?

Hi @ll,

I'm still trying to get the Mesh DFU example up and running. I'm following the guide in the documentation. (Mesh Version 2.0.0: it's the same in 2.0.1 so don't worry about the version)

Setup: Everything flashed (Softdevice 6.0.0, Bootloader, DevicePage and DFU example application)

Once I try to send a dfu packet the device throws this error:
<t:     452185>, nrf_mesh_dfu.c,  901, ERROR: No CMD handler!

Looking at the code I found something that looks strange to me:
nrf_mesh_dfu.c in mesh/dfu/src

uint32_t nrf_mesh_dfu_init(void)
{
    uint32_t error_code;
#if !defined(HOST)
    error_code = dfu_cmd_handler_set(*((bl_if_cmd_handler_t*) (DEVICE_DATA_RAM_END_GET() - sizeof(bl_if_cmd_handler_t))));
    if (error_code != NRF_SUCCESS)
    {
        m_transfer_state.state = NRF_MESH_DFU_STATE_INITIALIZED;
        return NRF_ERROR_NOT_SUPPORTED;
    }

This part calls dfu_cmd_handler_set with an address that is in the range of RAM (for the nRF52 about 0x2000xxxx)

But the function it self does/checks this:
nrf_mesh_dfu.c in mesh/dfu/src

static uint32_t dfu_cmd_handler_set(bl_if_cmd_handler_t handler)
{
    if (handler == NULL)
    {
        return NRF_ERROR_NULL;
    }
    if (BOOTLOADERADDR() == 0xFFFFFFFF)
    {
        /* No bootloader present. */
        return NRF_ERROR_NOT_SUPPORTED;
    }
    if (((uint32_t) handler >= DEVICE_FLASH_END_GET()) ||
        ((uint32_t) handler < BOOTLOADERADDR()))
    {
        /* out of bounds. */
        return NRF_ERROR_INVALID_ADDR;
    }

So it compares the address it gets with a FLASH address? Speaking about address in the range of 0x00000000-0x00080000.

So this will always return NRF_ERROR_INVALID_ADDR in case there is a bootloader address in NRF_UICR->NRFFW[0]? Otherwise it will always return NRF_ERROR_INVALID_ADDR?

Maybe I got something wrong Confounded

Thank you in advance for your help Slight smile

Bye
Andrej

Related