Closed zfields closed 2 years ago
D2 is not available as an input (it’s configured for the NFC antenna) unless you do a one-time (and hard to reverse) reconfiguration. See issue 728.
Of course, that doesn’t explain what you’re seeing when specifying pin 0. When I encountered the issue described in 728, D0 (TX) was one of my test pins and it worked as it should.
Were you using the Adafruit Feather nRF52840 Express or the Adafruit Feather nRF52840 Sense board?
@zfields as mentioned by @ajs123 D2 on Feather express and sense are the same (NFC GPIO P0.10). You will need to one-time run nfc2gpio sketch to convert it from NFC to gpio https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/libraries/Bluefruit52Lib/examples/Hardware/nfc_to_gpio/nfc_to_gpio.ino
check out #728 for detail
@hathach, I have a couple of questions...
If you would like D2 to be used as GPIO like D0, please read the other issue for explanation and run the sketch.
closed since duplicated to #728
@hathach There is a miscommunication...
D2 (the physical pin) responds programmatically to 0
.
As in,
pinMode(0,INPUT);
int d2_pin_value = digitalRead(0);
I have not run any scripts on my Feather nRF52840 Express, it is EXACTLY as it came from the Adafruit store.
Sorry if I mis-understood your description and/or didn't say it clear enough. D2 cannot be (reliably) used as GPIO without running the nfc_to_gpio
sketch first. Why it responses as if it is pin0 is an accident/mystery/bug I can't explain.
I have not run any scripts on my Feather nRF52840 Express, it is EXACTLY as it came from the Adafruit store.
yeah, and you need to run it once if you are using stock board + bootloader for D2 to work as gpio. We did auto-convert it to gpio in later bootloader version, if you don't want to run the sketch, just burn the latest bootloader
Sum up:
Operating System
Linux
IDE version
Arduino CLI 0.22.0
Board
Feather nRF52840 Express
BSP version
adafruit:nrf52@1.3.0
Sketch
What happened ?
With a momentary button connected to
D2
, when I defineBUTTON
as2
the LED does not flash. With a momentary button connected toD2
, when I defineBUTTON
as0
the LED flashes.The
RX
pin can be used by definingBUTTON
as1
as expected. TheTX
pin does not respond to definingBUTTON
as2
.How to reproduce ?
D2
.Debug Log
No response
Screenshots
This pinout diagramis clearly for the nRF52840 Feather Sense, but it is the only pinout diagram offered from the nRF52840 Feather Express Guide