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

nrf_dfu_wait funcion never return

hello,

I use nrf51822 + S130 + SDK12.2 in my product, nrf51822 work at central + peripheral mode,and i use nrf_duf_flash module for my dfu funtion.

The problem is, i use my dongle(as central role) connect my product(as peripheral role) and send dfu commands to it, when my product do not connect a peripheral as central role, it looks like work well, the dfu process is ok, but when my product do connect a peripheral as central role(that means my product has to connection both as central and peripheral), some times the dfu is ok, but some times, program will dead in nrf_flash_wait function,in the loop

while ((m_flags & FLASH_FLAG_OPER) != 0)
{
        (void)sd_app_evt_wait();
}

and never out.

my dfu code like this:

if (nrf_dfu_flash_store((uint32_t *)(IAP_STORE_ADDR + s_tIAPState.write_ptr), (uint32_t  *)data_buf, (data_len >> 2), NULL) != FS_SUCCESS)
{
    tCmdPar.index = IAPERROR_WRITEFLASH;
}
else                                    
{
    if (nrf_dfu_flash_wait() != FS_SUCCESS)
    {
        tCmdPar.index = IAPERROR_WRITEFLASH;
        break;
    }
  
    //other code
}

I also try SDK12.3, the problem is same.

Is this a bug of SDK? How can i fix it, or, if do not use nrf_dfu_flash module, what can i do?

Parents
  • As far as I know, you seem to be experiencing a feature, not a bug. sd_app_evt_wait will actually not return. When debugging, your IDE may lose its tracks when this functions is entered, because that function is an "end station". The nRF won't do any more work, unless a timer/interrupt/reset is done.

    Hope that helps.

    Edit: changed to sd_app_evt_wait

Reply
  • As far as I know, you seem to be experiencing a feature, not a bug. sd_app_evt_wait will actually not return. When debugging, your IDE may lose its tracks when this functions is entered, because that function is an "end station". The nRF won't do any more work, unless a timer/interrupt/reset is done.

    Hope that helps.

    Edit: changed to sd_app_evt_wait

Children
Related