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

NRF52840 - pin P0.02 as a digital input

I am using the nRF52840 dongle (pca1009).

I have read from some digital inputs successfully, but am not able to read from P0.02.

I set it up as an input with the following code:

#define TOUCH_OUT                         NRF_GPIO_PIN_MAP(0,2)

    nrf_gpio_cfg_input(TOUCH_OUT, NRF_GPIO_PIN_PULLDOWN);

I'm reading it with the following code (and I only get 0's coming out, even when I drive the pin high with a wire from my breadboard):

while (1)
{
if(nrf_gpio_pin_read(TOUCH_OUT)){ NRF_LOG_INFO("1");}
else {NRF_LOG_INFO("0");}
NRF_LOG_FLUSH();
}

I don't see any problems with using that pin as far as the hardware goes. Do I need to do something to disable the analog input function for that pin?

Parents Reply Children
No Data
Related