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.

Related