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

nrf connect sdk add custom section(UICR)

Hello

I want to add a UICR section. but I don't know how to add a custom section in ncs(also zephyr).

I have researched about this for days and I've found zephyr code realocation, but I don't want realocate the code. (SRAM, SRAM2, TEXT ...)

All I want is add a UICR section without realocate the other things.

Also I want to know how to change UICR REGOUT0 register value in ncs(also zephyr).

Thanks.

Parents Reply Children
  • Finally I have wrote this code.

    It works very well.

        // Write UICR's REGOUT0 register to given value
        #if ( CONFIG_NRF52_ENABLE_DCDC == 1 )  
            if ( NRF_UICR->REGOUT0 != (uint32_t)CONFIG_NRF52_DCDC_REGOUT_VALUE ) {
            
                nrfx_err_t err = NRFX_SUCCESS;
            
                NRF_UICR_Type tmp;
                memcpy( &tmp, NRF_UICR, sizeof(NRF_UICR_Type) );
                
                tmp.REGOUT0 = (uint32_t)CONFIG_NRF52_DCDC_REGOUT_VALUE;
                
                err = nrfx_nvmc_uicr_erase( );
                __ASSERT( (err == NRFX_SUCCESS), "NVMC erase UICR failed" );
                
                nrfx_nvmc_bytes_write( NRF_UICR_BASE, &tmp, sizeof(NRF_UICR_Type) );
                while ( nrfx_nvmc_write_done_check() != true );
                
                LOG_INF( "REGOUT0 writed to %u", CONFIG_NRF52_DCDC_REGOUT_VALUE );
            
            }    
        #endif
Related