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

nRF52840 VDDH and SWD

Dear All,

we use Reference configuration 4 and have connected the DK to our custom PCB. 3.3V of the DK go into VDDH and otherwise only GND and SWDIO/SWCLK are connected. We see 1.8V at VDD, but can't use SWD. In another thread I've read that the SWD needs voltage adjustment - so does it have to match VDD level? That would mean SWD requires 1.8V, right? 

Can we just use 

NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3;


to get 3.3V VDD level which then should in turn work with 3.3V logic at SWD?

Parents
  • well, sometimes I should just try. Was not sure how to do it because we're using Zephyr for this project, but simply adding a board.c (only important for those using Zephyr as well) with this code (copied from pca10059):

    static int board_nrf52840_pca10056_init(struct device *dev)
    {
    	ARG_UNUSED(dev);
    
    	/* if the nrf52840_pca10059 board is powered from USB
    	 * (high voltage mode), GPIO output voltage is set to 1.8 volts by
    	 * default and that is not enough to turn the green and blue LEDs on.
    	 * Increase GPIO voltage to 3.0 volts.
    	 */
    	if ((nrf_power_mainregstatus_get() == NRF_POWER_MAINREGSTATUS_HIGH) &&
    	    ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
    	     (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {
    
    		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_3V3 << UICR_REGOUT0_VOUT_Pos);
    
    		NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
    		while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
    			;
    		}
    
    		/* a reset is required for changes to take effect */
    		NVIC_SystemReset();
    	}
    
    	return 0;
    }
    
    SYS_INIT(board_nrf52840_pca10056_init, PRE_KERNEL_1,
    	 CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

    will give you 3.3V and make SWD attached to DK working nicely

Reply
  • well, sometimes I should just try. Was not sure how to do it because we're using Zephyr for this project, but simply adding a board.c (only important for those using Zephyr as well) with this code (copied from pca10059):

    static int board_nrf52840_pca10056_init(struct device *dev)
    {
    	ARG_UNUSED(dev);
    
    	/* if the nrf52840_pca10059 board is powered from USB
    	 * (high voltage mode), GPIO output voltage is set to 1.8 volts by
    	 * default and that is not enough to turn the green and blue LEDs on.
    	 * Increase GPIO voltage to 3.0 volts.
    	 */
    	if ((nrf_power_mainregstatus_get() == NRF_POWER_MAINREGSTATUS_HIGH) &&
    	    ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
    	     (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {
    
    		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_3V3 << UICR_REGOUT0_VOUT_Pos);
    
    		NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
    		while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
    			;
    		}
    
    		/* a reset is required for changes to take effect */
    		NVIC_SystemReset();
    	}
    
    	return 0;
    }
    
    SYS_INIT(board_nrf52840_pca10056_init, PRE_KERNEL_1,
    	 CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

    will give you 3.3V and make SWD attached to DK working nicely

Children
No Data
Related