How Can I Store the Device Name that won't change after a firmware update ?

Hi,

We are trying to change the name of our BLE device of our solution with being always different for each device. The device name would be like a serial number that is unique to each device.

Our project has a bootloader and via this bootloader, we can update the firmware of the device.

The goal is to have the possibility to change the device name via a mobile app (which works) but this device name needs to not changed when the firmware is updated, like a variable that is store in a part of the NRF52 that is not erased.

Does anyone knows how to do that ?

Big thanks,

Chris

Parents
  • Hello,

    I've been working on it, and I achieved to erase the UICR register and to write on it. But I got an issue...

    I've been receiving this error code : Received a fault! id: 0x00004001, pc: 0x00000000, info: 0x2000FF24

    If I understand it well, it's the NRF_ERROR_NO_MEM which means that there is no memory for the operation ? But If I debug my code, I can clearly see that the UICR register is erasing and writing well...

    Here's my code for the UICR register :

    static void write_name ()
    {    
        ret_code_t err_code;
    
        err_code = nrf_sdh_disable_request();
        APP_ERROR_CHECK(err_code);
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase;
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        NRF_UICR->CUSTOMER[0] = 0xAAAAAAAE;
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
    }

    Do someone have an answer to this issue ?

    Chris

Reply
  • Hello,

    I've been working on it, and I achieved to erase the UICR register and to write on it. But I got an issue...

    I've been receiving this error code : Received a fault! id: 0x00004001, pc: 0x00000000, info: 0x2000FF24

    If I understand it well, it's the NRF_ERROR_NO_MEM which means that there is no memory for the operation ? But If I debug my code, I can clearly see that the UICR register is erasing and writing well...

    Here's my code for the UICR register :

    static void write_name ()
    {    
        ret_code_t err_code;
    
        err_code = nrf_sdh_disable_request();
        APP_ERROR_CHECK(err_code);
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase;
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        NRF_UICR->CUSTOMER[0] = 0xAAAAAAAE;
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        err_code = nrf_sdh_enable_request();
        APP_ERROR_CHECK(err_code);
    }

    Do someone have an answer to this issue ?

    Chris

Children
Related