How to set the vdd level

Hi

         How to set the vdd level to 3.3v when the system is in the High Voltage mode?I can't fine any api about setting vdd level in document.

  • Hi

    The output voltage from REG0 is set with the UICR_REGOUT0 register in the nrf52833_bitfields.h header file in the MDK 

    /* Register: UICR_REGOUT0 */
    /* Description: Output voltage from REG0 regulator stage. The maximum output voltage from this stage is given as VDDH - V_VDDH-VDD. */
    
    /* Bits 2..0 : Output voltage from REG0 regulator stage. */
    #define UICR_REGOUT0_VOUT_Pos (0UL) /*!< Position of VOUT field. */
    #define UICR_REGOUT0_VOUT_Msk (0x7UL << UICR_REGOUT0_VOUT_Pos) /*!< Bit mask of VOUT field. */
    #define UICR_REGOUT0_VOUT_1V8 (0UL) /*!< 1.8 V */
    #define UICR_REGOUT0_VOUT_2V1 (1UL) /*!< 2.1 V */
    #define UICR_REGOUT0_VOUT_2V4 (2UL) /*!< 2.4 V */
    #define UICR_REGOUT0_VOUT_2V7 (3UL) /*!< 2.7 V */
    #define UICR_REGOUT0_VOUT_3V0 (4UL) /*!< 3.0 V */
    #define UICR_REGOUT0_VOUT_3V3 (5UL) /*!< 3.3 V */
    #define UICR_REGOUT0_VOUT_DEFAULT (7UL) /*!< Default voltage: 1.8 V */

    Best regards,

    Simon

  • Hi

            I use SES,How to set in SES,Thanks.

  • Hi

    You can do something similar to the gpio_output_voltage_setup() function in boards.c as part of your main application, and that should set the GPIO output voltage to 3.0V.

    /**
     * Function for configuring UICR_REGOUT0 register
     * to set GPIO output voltage to 3.0V.
     */
    static void gpio_output_voltage_setup(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_3V0 << 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();
        }
    }

    Best regards,

    Simon

Related