Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840DK GPIO Pull-Up not working?

Dear Nordic Semiconductor-Team and everyone else,

thank you for helping the thousands of people in this forum an answering their questions thoroughly.
I have a question/problem regarding the pullup resistors using my nRF52840DK. 

I am trying to use the Pins P0.09 and P0.10 as input pins with the internal pullups enabled.
I am using the GPIO HAL layer as follows:

As a first step I am configuring the mentioned pins as input pins with the input buffer connected and the pullup resistors enabled.

nrf_gpio_cfg(NRF_GPIO_PIN_MAP(0, 9), NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
nrf_gpio_cfg(NRF_GPIO_PIN_MAP(0,10), NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);

To see if the registers are set correctly I call the functions nrf_gpio_pin_dir_get() and nrf_gpio_pin_pull_get() which both return the correct values (0 for NRF_GPIO_PIN_DIR_INPUT  and 3 for NRF_GPIO_PIN_PULLUP )

My understanding is, that if I read the input value of those pins now with nrf_gpio_pin_read() and without anything connected to the pins, I should read a 1 (HIGH) value, but in my case I am reading a 0 (LOW) value.

Adittionaly when I try to measure the pullup pin with my voltmeter, I am reading 0 Volts on that pin. In my understanding that would mean, the pullup resistor actually is not connected.

Can you tell me what I am missing, or why my understanding of how all of that works is wrong?
Thank you in advance!

Parents
  • Hello,

    I think this is as simple as you are using pin 9 and 10. There are two things you need to do in order to use these as normal GPIOs on your nRF52840 DK:

    1: Check the file system_nrf52840.c. There is a line saying:

        #if defined (CONFIG_NFCT_PINS_AS_GPIOS)

    This needs to be defined in order to use the NFC pins as normal GPIOs. These pins happens to be pin P0.09 and P0.10 on the nRF52840.

    So to use them as normal GPIOs, please add the definition CONFIG_NFCT_PINS_AS_GPIOS to your preprocessor definitions, just like the definition CONFIG_GPIO_AS_PINRESET is set in all of the SDK examples (which is used to configure the reset pin to act as the reset pin).

    When this is done, take a look at the back side of your DK. In the table it says that the pins P0.09 and P0.10 are the NFC pins. These pins are not connected to the pinout on the DK. If you want to connect them, you need to move the 0R resistors from R44 to R43 and from R46 to R45. This is also described here.

    So, if you want to use these pins on the DK, you need to do both of these changes. If you strictly don't need those pins exactly, it may be easier to use some other pins for what you are doing, and you don't have to desolder and solder the 0R resistors.

    Best regards,

    Edvin

  • Hey Edvin,

    thank you very much for taking the time explaining this to me.
    Your technique worked flawlessly and I can now use these pins as normal GPIO pins.

    You just made my day Smiley


    Best regards

    Maximilian

Reply Children
No Data
Related