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

NRF_UICR->CUSTOMER read/write on 52832

Hello,
I'm trying to port my code (working in production) from 52811 to 52832.

I have several crashes on a piece of code at the start of my application that check the NRF_UICR, and based on the value does something then erases it.

When I say crash, it restarts the application, without entering app_error_fault_handler 

// Check first two bytes of NRF_UICR->CUSTOMER
if ( NRF_UICR->CUSTOMER[0] != 0x0 || NRF_UICR->CUSTOMER[1] != 0x0 ) {
    
    // Read NRF_UICR->CUSTOMER[i], i from 0 to 8
    (...)
    
    //Erase first two bytes of NRF_UICR->CUSTOMER
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    NRF_UICR->CUSTOMER[0] = 0x0;
    NRF_UICR->CUSTOMER[1] = 0x0;
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
}
 

What could be different between 52811 and 52832 on this matter ?

Best regards,
Quentin

Parents Reply
  • Since this is not triggered from app_error_fault_handler(), then I suspect it is triggered by HardFault_process().

    Try to add/change #define HARDFAULT_HANDLER_ENABLED 1 to sdk_config.h.

    In addition:

    Hardfault_handler_<toolchain>.c needs to be included in order for HardFault_c_handler() (by hardfault_implementation.c) to be invoked on a fault exception. Did you include one of the handler files from \components\libraries\hardfault\nrf52\handler (different versions depending on toolchain)?

    Edit: The code snippet you shared seems to work on an nRF52832 I have here without any issues.

    Best regards,
    Kenneth

Children
Related