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

nRF52 defines in ble_hrs example

I'm using nRF52+SDK11.0.0+s132. In the ble_hrs PCA10040 example, the following are defined:

BLE_STACK_SUPPORT_REQD BOARD_PCA10040 NRF52_PAN_12 NRF52_PAN_15 NRF52_PAN_20 NRF52_PAN_30 NRF52_PAN_31 NRF52_PAN_36 NRF52_PAN_51 NRF52_PAN_53 NRF52_PAN_54 NRF52_PAN_55 NRF52_PAN_58 NRF52_PAN_62 NRF52_PAN_63 NRF52_PAN_64 CONFIG_GPIO_AS_PINRESET S132 NRF_LOG_USES_UART=1 SWI_DISABLE0 NRF52 SOFTDEVICE_PRESENT

I couldn't find NRF52_PAB_xx being used in the code. What are these? Also, if I'm not using pin21 for reset, all I need to do is remove CONFIG_GPIO_AS_PINRESET from the defines and I can use pin21 as a GPIO?

Parents
  • FormerMember
    0 FormerMember

    Yes, if you don't want to use pin 21 as GPIO, all you need to do is to remove CONFIG_GPIO_AS_PINRESET. As you can see in system_nrf52.c pin 21 will be configured as a pin reset if CONFIG_GPIO_AS_PINRESET is defined:

    #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] = 21;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_UICR->PSELRESET[1] = 21;
            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
    

    Unfortunately, I don't know why all the PANs are included in the projects, as I cannot either see that they are ever being used. I have reported this internally.

  • I removed CONFIG_GPIO_AS_PINRESET from the defines and if I press the reset button on the nRF52-DK, the system seems to still reset. Or is only the Atmel MCU resetting and the nRF52 isn't?

Reply Children
No Data
Related