NFC as GPIO on nRF52833

Using nRF52832, I've got some firmware that uses NFC pins (9 & 10) without problem, using CONFIG_NFCT_PINS_AS_GPIOS.

I'm now trying to replicate this using nRF52833, and I'm failing.

I used ble_app_blinky as a starting point (for PCA10056), and just put this in main():

    if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
            NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
            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();
    }

    for (int pin = 0; pin < 32; ++pin)
  {
    nrf_gpio_pin_dir_set(pin, NRF_GPIO_PIN_DIR_OUTPUT);
  }
  while (1)
  {
    for (int pin = 0; pin < 32; ++pin)
    {
      nrf_gpio_pin_set(pin);
    }

    nrf_delay_ms(1000);

    for (int pin = 0; pin < 32; ++pin)
    {
      nrf_gpio_pin_clear(pin);
    }

    nrf_delay_ms(1000);
  }
  

Note the first bit was added after, just to make sure the NFC pins are reprogrammed.

However, pin 9 & 10 still don't get toggled by this code.

Checking the value of NRF_UICR->NFCPINS, it's 0xFFFFFFFE, so I don't understand what's wrong... Thanks!

Parents Reply
  • I think you should execute the 'nrfjprog --eraseall' and check by reading 'nrfjprog --memrd 0x1000120C --w 32 --n 4' when/if NFC pins are enabled at any time. They should not be enabled if you have added CONFIG_NFCT_PINS_AS_GPIOS in the preprocessor of your project.

    Additional question; If you are using the nRF52840-DK, are you sure you have followed the description on the back side of the DK in terms of soldering bridges such that the GPIO's are connected to the header?

    Kenneth

Children
Related