Setting VDD to 3.0V

We have developed a small PCB that connects with some other HW. The integrated nRF52840 runs in HighVoltage-Mode and its required to set VDD to 3.0V. The question - how to do this - was discussed in several articles - I read them all and tried most codes - but nothing really runs. It is posible to set REGOUT0 in UICR 0x304 to 0x04. After the necessary Reset, this works in RUN-Mode outside IDE. In Debugger-Mode the Debugger shows an HW-error and stops. This happens also if I change the value during the Init-process in the program. As I agree with some comments, the much better way is to modify the setting for REGOUT0 during the building-process. There are some examples, I tried them too, but without success. Because some comment are over three years old, may be there were some changes. I hope, that there is a reliable solution.

Thanks in advance 

Juergen

Parents Reply Children
  • I use J-Link ultra + and I just checked the description: It works with 1,2 up to 5V.

    The HW fault occurs when I change 0x304 after build - I tried this as a workaround. But isn't it better to set 0x304 in the build-process? 

  • You might have to disconnect/reconect/power-cycle the debug probe after you've changed the I/O voltage (changed VDD from 1.8V to 3.0V).

    Juergen said:
    The HW fault occurs when I change 0x304 after build - I tried this as a workaround. But isn't it better to set 0x304 in the build-process? 

    What exactly do you mean by setting the valtage in the build-process and after build? 
    Do you mean do say that you're setting the voltage by writing to UICR with the debugger vs the MCU's app?

  • 1. Debugger Problem:

    I included this snippet in my program, found in "boards.c":
    /*
    * 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();
          }
    }

    If I exclude "NVIC_SystemReset();" everthing is running ok, but VDD is still 1,8V. With a RESET or with "NVIC_SystemReset();" the debugger stops  with a HW error.

    2. What do I want as a perfect solution:

    This is also explained in this comment by Jakob: 

    devzone.nordicsemi.com/.../113169

    But unfortunately I don't get it run. Esspacially I have not found this path "Code > Build > Memory Segments " 

  • Your question regarding the J-Link has brought me to a solution:

    Yes, the J-Link is able to work in this Range, but has to be restartet. So if I do as described befor until the Debugger stops with the HW-Error and then I restart and reconnect the J-Link in SES the Debug-Mode runs fine with 3V.

    With this solution I can go on with my project.

    So I would say my idea about a perfect solution will not run.  No matter when VDD is changed - the J-Link has to be switched to 3V. This would run only perfectly if the J-Link would have an automatic Level adjustment. 

    Thank you a lot for your help. 

  • One final question from my side:

    How to run the solution I mentioned before (devzone.nordicsemi.com/.../113169).

    I made the changes as described:

    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"))) = 4;
    

    But after build and starting the debugger, REGOUT0 is "0xFFFFFFFF"" and not "0x00000004".

    What is the reason?

Related