0

Feather D2 pin as input vs DFU / FTHR840BOOT
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather D2 pin as input vs DFU / FTHR840BOOT

by kevinjwalters on Sun Aug 08, 2021 10:28 am

I'm using a Feather nRF52840 Express and possibly for the first time attempted to use its D2 pin as an input. The initial testing with pulseio.PulseIn() appeared to go well. I then either pressed reset or power cycled it by pulling USB and it came up with FTHR840BOOT rather than CIRCUITPY file system. After that I couldn't get CIRCUITPY to return by normal means, reset doesn't work, power cycle doesn't work and the nRF52840-specific 5 minute timeout (300 second) bootloader thing doesn't work. I can plop CircuitPython back on it but should I have to do this?

In Adafruit Forums: Questions about the Feather nRF52840 Express I see mention of DFU functionality and reference to the documentation for a different board, the Adafruit Feather nRF52 Bluefruit. The text from Bluefruit nRF52 Feather Learning Guide: Device Pinouts: Special Notes says:

PIN_DFU / P0.20: If this pin is detected to be at GND level at startup, the board will enter a special serial bootloader mode and will not execute any user code, going straight into bootloader mode. If you wish to use this pin as a standard GPIO, make sure that it is pulled high with a pullup resistor so that your code will execute normally when the MCU starts up.


That doesn't really mention the getting stuck phenomena and perhaps doesn't highlight how a pullup resistor may be unsuitable for using it as an input with some peripherals.

More importantly, the primary guide for the board in question doesn't appear to cover this D2 topic. It does perplex further with the User/DFU Switch which is actually a button and connected to the processor's P1.02 pin. D2 for this board is described as:

D2/NFC2: The D2 pin is uses the same pad as one-half of the NFC antenna pins. By default, the nRF52840 Feather ships with these pins configured for GPIO mode, which is done by writing a value to the UICR flash config memory. If you wish to use NFC, you will need to erase the UICR memory which requires erasing the entire chip, and you will need a Segger J-Link to reflash the bootloader and firmware.


I don't know if it makes any difference but I updated the bootloader a while ago from 0.2.6 (shipped with that) as that interacted badly with Windows. I've only been using CircuitPython on this board and have not used NFC.

Code: Select all | TOGGLE FULL SIZE
UF2 Bootloader 0.3.2 lib/nrfx (v2.0.0) lib/tinyusb (legacy-1500-g23df777b) s140 6.1.1
Model: Adafruit Feather nRF52840 Express
Board-ID: nRF52840-Feather-revD
Date: Mar 12 2020

kevinjwalters
 
Posts: 979
Joined: Sun Oct 01, 2017 3:15 pm

Re: Feather D2 pin as input vs DFU / FTHR840BOOT

by adafruit_support_mike on Tue Aug 10, 2021 9:07 pm

Pin D2 has nothing to do with the nRF52840’s DFU process.

The fact that the board’s CIRCUITPY filesystem stopped working is probably related to a glitch in USB communication, and only related to your use of D2 by coincidence.

You probably will need to drag a fresh copy of the CircuitPython UF2 image onto FTHR840BOOT to get a working CircuitPython environmental again. There’s no easy way to debug the current version to find out what went wrong, let alone edit the data to try and make it work again.

USB glitches happen sometimes, and making firmware robust in its ability to survive them takes additional code. The more bulletproof the environment is, the less space is left for your own code. We chose to leave more space for user code and a quick ‘just start again from scratch’ recovery process when something dies go wrong.

adafruit_support_mike
 
Posts: 63729
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather D2 pin as input vs DFU / FTHR840BOOT

by kevinjwalters on Fri Aug 13, 2021 5:03 pm

I had a Pimoroni Enviro+ FeatherWing on top and a few other things connected. I just pulled all that off and went to the bare Feather nRF52840 Express with just its header pins on. That was working fine with 6.3.0. I connected its Gnd pin to D2 and pressed reset button on the board and up comes FTHR840BOOT. Now it's stuck on that as if CircuitPython got nuked, pulling power via USB disconnect/reconnect just goes back to FTHR840BOOT.

Would be useful if someone has an identical board to test this out to see if they all do it.

kevinjwalters
 
Posts: 979
Joined: Sun Oct 01, 2017 3:15 pm

Please be positive and constructive with your questions and comments.