Hello,
I am working on a custom board using a nRF52840 based module. I am using SDK 14.2
I am running the following simple code to sense when an GPIO goes to a low state(detects SD card insertion) and toggle an LED.
GPIO P0.13 is connected to a SD card detect pin which gets grounded if an SD card is inserted, else it is left floating.
GPIO P0.15 is connected to an anode of an LED.
int main(void) { nrf_gpio_cfg_input(13, NRF_GPIO_PIN_PULLUP); nrf_gpio_cfg_output(15); uint32_t new_CD; while (true) { new_CD = nrf_gpio_pin_read(13); if (new_CD == 0) { nrf_gpio_pin_toggle(15); } // Do nothing. } }
However, the controller does not detect a low state on P0.13, when I insert the SD card. I have verified that the pin is indeed grounded using a oscilloscope.
During debugging, the 'new_CD' variable on the watch window is also always '1'.
Why cant I detect a low state on the GPIO correctly?
Thanks