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

How to enable P0.09 and P0.10 as GPIO pins on the nRF52 instead of NFC pins?

Hi,

I'm using nrf52 custom board designed for our project,For this we have P0.09 and P0.10 as rx and tx used for uart, when i configured this two pins as rx and tx it is not showing any data on the uart.I have read the datasheet and i have seen this link devzone.nordicsemi.com/.../
but i'm not able to resolve the problem ,please help me ASAP.

Regards,

Prudhvi.

  •  I also needed to add the -DCONFIG_NFCT_PINS_AS_GPIOS CFLAG inside the bootloader Makefile as well

    In my case I was using P009 as a CS for SPI and I could not get it to work from the APP but the interesting part is that when using JLINK on my board including a 3.3 V and GND pin it would reset the board powered through USB on my laptop it was working. Connection to Jlink RTT viewer reported correct reading on MISO after driving CS PIN 0.09 porperly. But then after a power off the pin didn't work anymore again for CS PIN 0.09. Is there a sequence diagram explaining what JLINK does in the NRF52 when driving the reset PIN. I am still scratching my head around this and why I can't see the register being persisted

  • Can you clarify where 0xFFFFFFFE should be set ? I set it 

    const uint32_t UICR_ADDR_0x20C __attribute__ ((section(".uicrNfcPinsAddress"))) __attribute__((used)) = 0xFFFFFFFE;

     

    but after flashing if I read the value it is 0x00000000

    I can't get to set the register value to 0xFFFFFFFE

    nrfjprog --memrd 0x1000120c --n 4 -f NRF52
    0x1000120C: 00000000 |....|

  • As a guide, it's best to use the Nordic project-level defines as listed for NFC and Reset pins, as the UICR register is part of the Flash memory, and it must not be repeatedly written (max 181 times) as it would be by an indiscriminate register write in user code on every reset. The Nordic SystemInit() checks the value before writing when using the defines to avoid repeated writes. This also means the NFC pins can not be easily repeatedly switched between NFC mode and I/O port mode.

    I quote:

    "11.3 Writing to user information configuration registers (UICR)
    User information configuration registers (UICR) are written in the same way as Flash. After UICR has been
    written, the new UICR configuration will only take effect after a reset.
    UICR can only be written nWRITE number of times before an erase must be performed using ERASEUICR or
    ERASEALL."

    nWRITE,BLOCK Amount of writes allowed in a block between erase 181

  • Hi I am going through the same issue. I defined CONFIG_NFCT_PINS_AS_GPIOS in the project preprocessor definitions and I added CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS to my project makefile. I still think my pin 9 is causing troubles (it's pegged to 3.3V). 

    How do I make sure the registers are being set by the code ? Do I have to add the line #include uicr_config.h anywhere in my main.c code?  

  • You can check that the correct value has been written to the UICR register using nrfjprog, i.e. 

    nrfjprog --memrd 0x1000120C

    which will return

    0x1000120C: FFFFFFFE |....|

    If the NFCPINS register is configured to use the NFC pins as GPIOs.

Related