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
  • It should be possible to change the priority of the BLE events like this:

    NVIC_SetPriority(SD_EVT_IRQn, 7);
    

    But be aware that you should only use interrupt priorities allocated to the application, and using an interrupt priority higher than the SVC handler doesn't really make sense (since it means you can't call SoftDevice functions inside the event handler), so the only recommended options are 6 and 7.

Reply
  • It should be possible to change the priority of the BLE events like this:

    NVIC_SetPriority(SD_EVT_IRQn, 7);
    

    But be aware that you should only use interrupt priorities allocated to the application, and using an interrupt priority higher than the SVC handler doesn't really make sense (since it means you can't call SoftDevice functions inside the event handler), so the only recommended options are 6 and 7.

Children
No Data
Related