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

nvmc writing hangs after enabling Softdevice

Dear nordic specialists,

We have our own custom nRF51822 boards.

These days we are migrating from QFAAC0+SDK4.1.0+S110 5.0.0 to QFAAG0+SDK5.2.0+S110 6.0.0.

We heard there was such problem: when writing flash during ble radio, it hangs. And we have a double-checking method to avoid that, using both ble_radio_notification.c and our own ble status polling.

On our old boards, that method is ok and nvmc writing calls works well. But on the new ones, nvmc always hangs when enabling WEN bit: NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een;(from nrf_nvmc.c, nrf_nvmc_write_byte()). It hangs right there, we saw this both by debugging over jtag and by screen printing. What's more, we tried nvmc writing before enabling Softdevice, it works well as expected.

We do appreciated your help, thanks!

Parents
  • Writing to flash has been moved into the softdevice from v6.0.0 and newer. If you look at the file nrf_soc.h, you have functions for writing and erasing.

    To write into flash:

    ...
    err_code = sd_flash_write(dest_addr, buffer, sizeof(buffer));
    ...
    

    Then you will get a callback in the system event handler set in "softdevice_sys_evt_handler_set". Let's call this callback function "sys_evt_dispatch" (as we do in our examples):

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
     ...
    /* Handle sys_evt cases NRF_EVT_FLASH_OPERATION_SUCCESS and  NRF_EVT_FLASH_OPERATION_ERROR */  
     ...
    }
    

    Remember that your buffer must either be global, or you have to set a flag in a while-loop to ensure that the buffer is still on the stack.

Reply
  • Writing to flash has been moved into the softdevice from v6.0.0 and newer. If you look at the file nrf_soc.h, you have functions for writing and erasing.

    To write into flash:

    ...
    err_code = sd_flash_write(dest_addr, buffer, sizeof(buffer));
    ...
    

    Then you will get a callback in the system event handler set in "softdevice_sys_evt_handler_set". Let's call this callback function "sys_evt_dispatch" (as we do in our examples):

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
     ...
    /* Handle sys_evt cases NRF_EVT_FLASH_OPERATION_SUCCESS and  NRF_EVT_FLASH_OPERATION_ERROR */  
     ...
    }
    

    Remember that your buffer must either be global, or you have to set a flag in a while-loop to ensure that the buffer is still on the stack.

Children
Related