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

Configuring VDD output when using a soft device - possible?

Hi there,

I'm presuming that, when using the s140 soft device (or any of the soft devices), I cannot change the output of VDD to anything and must assume 3V.

I have tried the following, but the soft device complains of an invalid memory access:

    // Configure UICR_REGOUT0 register so that VDD is 1.8V.
    if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) !=
        (UICR_REGOUT0_VOUT_1V8 << UICR_REGOUT0_VOUT_Pos))
    {
        NRF_LOG_DEBUG("Configuring 1.8V for VDD");

        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
        {
        }

        NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
                            (UICR_REGOUT0_VOUT_1V8 << UICR_REGOUT0_VOUT_Pos);

        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
        {
        }

        // System reset is needed to update UICR registers.
        NVIC_SystemReset();
    }

Thanks for any confirmation.

Parents
  • Hi,

    You are right that there are no functions to write UICR registers while the softdevice is enabled, and the softdevice prevents you from accessing the NVMC controller directly. UICR acts the same way as flash, and CPU will be halted during flash write/erase operations. The softdevice has real-time requirements that could be broken if the CPU is halted during one of these tasks, which is why it is not allowed.

    Do you have a requirement to change the REGOUT0 register during runtime of the application? If not, just write the UICR register before enabling the softdevice in your application. The new voltage configuration is anyway not applied before you reset the device, so you could disable the softdevice before writing the register, if you need to change the voltage during runtime.

    Best regards,
    Jørgen

  • Thank you! I will look at configuring prior to soft device enablement. Will the buttons still work with 1.8v; I’m presuming so?

Reply Children
No Data
Related