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

nRF52832 can nRESET be programmed to any GPIO using PSELRESET[0] & PSELRESET[1] registers ?

On the previous nRF51822 project the SWDIO pin could be used for nRESET.

The nRF52832 Product Specification and example code program nRESET to P0.21.

The Product Spec hints another GPIO may be used by programming the AAAAA bits. But then states the Value as 21 - and then in the description says P0.n onto which Reset is exposed. So it is ambiguous as to if it can be programmed to P0.0-through-n or if 21 is the only value it may be programmed to.

Can PSELRESET[0]/[1] be programmed to any P0.n pin or exclusively to P0.21 ?

Parents
  • Hi Robert

    Can PSELRESET[0]/[1] be programmed to any P0.n pin or exclusively to P0.21 ?

    The RESET pin can only be enabled on P0.21. 

    I believe we had a plan at some point to make this reconfigurable, but in the end it was decided to limit it to a single pin only. 

    Best regards
    Torbjørn

  • Hi,

    so when does the PSELRESET0/1 get to a value of 21. is MBR writing to it?

    on an erased part, if I read the PSELRESET0/1 registers, I get 0xFFFFFFFF.

    Best Regards

    Santosh Athuru

  • Hi Santosh

    All you have to do to set these registers is to define CONFIG_GPIO_AS_PINRESET in your project settings. 

    Then the system_nrf52xxx.c file will automatically check if the PSELRESET registers are updated, and set them correctly if they are 0xFFFFFFFF. 

    Below I added the code from the system_nrf52840.c file for reference:

        /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
          defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
          reserved for PinReset and not available as normal GPIO. */
        #if defined (CONFIG_GPIO_AS_PINRESET)
            if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
                ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[0] = 18;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[1] = 18;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NVIC_SystemReset();
            }
        #endif

    Best regards
    Torbjørn

Reply
  • Hi Santosh

    All you have to do to set these registers is to define CONFIG_GPIO_AS_PINRESET in your project settings. 

    Then the system_nrf52xxx.c file will automatically check if the PSELRESET registers are updated, and set them correctly if they are 0xFFFFFFFF. 

    Below I added the code from the system_nrf52840.c file for reference:

        /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
          defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
          reserved for PinReset and not available as normal GPIO. */
        #if defined (CONFIG_GPIO_AS_PINRESET)
            if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
                ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[0] = 18;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[1] = 18;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NVIC_SystemReset();
            }
        #endif

    Best regards
    Torbjørn

Children
No Data
Related