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

nRF52840 regulator configuration

Hello

I have just started development for the nRF52480 preview development kit.

I am powering the dev kit through USB on J2 (with power switch set to VDD).

I want to power peripherals with 3.3V so I am trying to write configuration for the REG0.

From what I can see from the OPS this requires changing EXTSUPPLY and REGOUT0 in the UICR registers, as well as DCDCEN0 in the POWER registers.

I have trouble finding any information on how to do this. I have found one function in the nrf_soc.h for the softdevice I might be able to use for enabling DC/DC converter but otherwise nothing.

For reference I am using SES for development.

  • Hi,

    Try to add something like this at the start of main() function

    if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3) 
    {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3;
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    }
    
    

    Note: you might need to reset the board once for the new UICR configuration to take effect.

  • I saw elsewhere that it is best to not change the UICR values in runtime, since it is a configuration. So instead it should be written when downloading the firmware to flash. This would be needed when powering other peripherals, as they would otherwise get the wrong voltage until REGOUT0 is set properly.

    I have managed to do this in SES by adding UICR to the flash_placement file and adding a const value with the value I need.

    In flash_placement.xml:

    <MemorySegment name="UICR" start="$(UICR_START)" size="$(UICR_SIZE)">
      <ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_regout0" start="0x10001304" size="4"/>
    </MemorySegment>
    

    In uicr_config.h (included in main.c):

    const uint32_t REGOUT0 __attribute__((section(".uicr_regout0"))) = 5;
    

    Now my only issue is that I have trouble getting the chip running in high voltage mode with the dev kit powered by J2. Any ideas for this?

  • You can't power the PDK in high voltage mode using J2. You will need to use J3(nRF USB) for that.

    The 5V from J2 goes to the interface MCU(Segger OB debugger/programmer), but when this power is routed to the nRF, it is regulated down to 3V with the on-board buck regulator.

  • Hi Sigurd

    Thank you. I was able to do it with 2 USB cables, one to J2 and one to J3, and then switching power supply selection to USB. Now I can use the high voltage mode and program and debug through J2.

  • In the SDK v15.0.0 SES projects you also have to modify the Code > Build > Memory Segments under the Common configuration to add the UICR segment, i.e. 

    Code > Build > Memory Segments FLASH RX 0x0 0x100000;RAM RWX 0x20000000 0x40000;UICR RX 0x10001000 0x304

Related