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

regarding the nrf52840 with setup for GPIO output 1.8V

1. regarding about trying to make the GPIO pin as 1.8V output for nrf52840

I try to make my board to work with theGPIO output 1.8V, I have calling the code below after the start, but it still has GPIO output for the pin as 3.2V, could you please help?

The power supply for the nrf52840 is 3.3V. I am using the jlink to flash the code from segger embedded studio with "F5" debug into the board.

#define BLUE_LED  24 

static void gpio_output_voltage_setup_1_8(void)
{
    // Configure UICR_REGOUT0 register only if it is set to default value.
    if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
        (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))
    {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
        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;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

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

int main(void)
{

    
    gpio_output_voltage_setup_1_8(); 
	nrf_gpio_cfg_output(BLUE_LED);
	nrf_gpio_pin_set(BLUE_LED);
    for (;;)
    {
        idle_state_handle();
    }
   
}

it seems the condition of  below does not meet up the requirements, but when I remove this "if" condition, seems the code stuck after I run it

if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))

2. With the GPIO pin output setup as 1.8V, could I make the power supply voltage for the nrf52840 to work as 4.3V-1.8V? 

Related