0

Help: NRF52840 always power on in DFU mode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Help: NRF52840 always power on in DFU mode

by Ashfox on Wed Apr 07, 2021 5:59 am

Hi, with my NRF52840 feather express, I can connect to serial, flash the bootloader, upload a sketch, i.e. blink LED & other sketches work fine too, as long as the PC remains connected.
All is normal until I power cycle, so either disconnect/reconnect to the PC, or power using a 3.7V Battery or USB battery bank,
When the board powers on again, the neopixel is constantly Red, the D3 LED flashes Red, and the program doesn't run. The Blue Conn LED never lights up and the Reset button has no effect.
I checked the power supplies, all are normal. All other hardware was removed.
As mentioned above, I updated the bootloader.
I tired a Factory Reset, by connection D2 to GND during Reset - this appears to work, the Blue Conn LED now Flashes.
After Factory Reset, I flashed the Bootloader and Programme, after power cycle, the same fault continues - always on RED neo-pixel and DFU mode when reconnect to PC.
I think its either a hardware fault or flash memory corruption - is there a way to erase all memory on the NRF52840.
I don't have a J-Link adaptor but could considering buying one if this is going to be a regular occurrence - I plan on using this many of these Feathers.
I have tried everything I can think of, any suggestions welcome.
Thanks

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Wed Apr 07, 2021 8:22 pm

@Ashfox,

Which utility are you using to flash the bootloader? What version of the bootloader have you been using?

Have you tried the adafruit-nrfutil?

https://learn.adafruit.com/introducing- ... bootloader

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help: NRF52840 always power on in DFU mode

by Ashfox on Thu Apr 08, 2021 7:02 am

Hi,
I am using the Arduino IDE to flash the bootloader. I had the problem with version 0.3.2 (feather express) and then updated to version 0.5.0, but the problem still remains.
I was a bit confused on how to use the adafruit-nrfutil stand-alone, the instructions for using the command in windows are too vague for me, I tried using command prompt but I couldn't get it to work, so I went back to using the Arduino IDE and managed to get the 0.5 version flashed.
The instructions for adafruit-nrfutil states "use this command, in the folder", what software am I supposed to use to give this command?
For some reason the Arduino boards package (latest version 0.21) is stuck at 0.3.2 bootloader version, why doesn't this get updated?
Updating the bootloader didn't fix the issue, any other suggestions? Thanks

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Thu Apr 08, 2021 3:21 pm

@Ashfox,

The Arduino IDE tends to lag on all libraries / boards and bootmanagers. It is not under our direct control in terms of updates so we provide other ways to update such as dropping the UF2 file of the bootloader on the BOOTPY drive devicename or using adafruit-nrfutil.

The adafruit-nrfutil might be worth giving a try for the firmware update just to get used to the process. I was not able to locate any "erase all" type arguments, but the new bootloader does replace the old one. The reason a change to the directory is mentioned is because of the way the zip files is packaged. You download a zip and within that is a hex file and another zip. I grabbed the file to show this more clearly:

Code: Select all | TOGGLE FULL SIZE
$ unzip -d nrf52bootloader feather_nrf52840_express_bootloader-0.5.0.zip
Archive:  feather_nrf52840_express_bootloader-0.5.0.zip
  inflating: nrf52bootloader/feather_nrf52840_express_bootloader-0.5.0_s140_6.1.1.hex 
  inflating: nrf52bootloader/update-feather_nrf52840_express_bootloader-0.5.0_nosd.uf2 
 extracting: nrf52bootloader/feather_nrf52840_express_bootloader-0.5.0_s140_6.1.1.zip
$ cd nrf52bootloader/


You would change to created directory and then flash with a command that looks like this:

Code: Select all | TOGGLE FULL SIZE
$ adafruit-nrfutil --verbose dfu serial --package feather_nrf52840_express_bootloader-0.5.0_s140_6.1.1.zip
 -p /dev/ttyACM0 -b 115200 --singlebank --touch 1200


This is pretty much what the Arduino IDE is running, but it has an older bootloader file.

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help: NRF52840 always power on in DFU mode

by Ashfox on Fri May 07, 2021 1:42 pm

Three feather NRF52840 (4062) express boards have developed an unrecoverable fault. Two of these boards were bought recently from Mouser and both have developed the same fault in just a few weeks of use. I previously used the Feather NRF52832 (3406) in the exact same application for several months with no issues.

The issue is as follows: the boards when connected by USB can be programmed and function normally when any sketch is loaded. However when power is removed (i.e. USB disconnected), and then power re-applied (USB or battery), the boards always enter DFU mode and the program doesn’t run. This makes the boards unusable since the program is lost every time power is lost.
I tried everything, factory reset of the NRF52 module, loading different Bootloaders, latest version (5.0) and also reverting to older Bootloaders (3.2); none of this has any effect.

I’m very frustrated, I spent a lot of money over the years on adafruit products and this is the first time I genuinely believe the product is at fault. I have spent many days trying to resolve the issue, searching the Adafruit and Nordic forums, trying out different solutions.

I would like to request replacements, and I’m happy to send back the boards that are faulty.

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Sat May 08, 2021 12:38 pm

@Ashfox,

This does sound like a memory corruption issue which can happen with our Express boards so you would not have seen this issue on the older nRF52832 Feathers you have been using.

The easy way to repair the flash space is to switch your Feather nRF52840 Express into bootloader mode, drop the CircuitPython image onto the BOOT device and run the commands from the REPL.

https://learn.adafruit.com/adafruit-its ... 2987288-25

Code: Select all | TOGGLE FULL SIZE
>>> import storage
>>> storage.erase_filesystem()


The next time you go to program your board withe Arduino it will wipe out the CircuitPython install which is what you want to go back to your original code.

Let's see if this resolves it. Should it work then try to reduce the amount of disconnects of the Feather without unmounting from your PC to reduce filesystem corruption.

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help: NRF52840 always power on in DFU mode

by Ashfox on Sat May 08, 2021 3:25 pm

@mikeysklar

Hi, thanks for your reply. I did exactly as you said but unfortunately it didn't fix the problem. I copied the nrf52840_express-en_US-6.2.0.uf2 file into Boot drive and then used Mu serial (REPL) to send the two commands to erase the file system. The Boot drive re-appears and then I used the Arduino IDE (all up to update) to upload the blink sketch, that works until either power on/off or reset, then the board enters DFU mode again, i.e. the Boot drive, so the sketch is seemingly lost.

I came across some older forum posts describing the same issue, one user said they resolved the issue by using the J-Link programming adapter to burn the boot loader. Can you comment on this? Could this be a solution and what's your advice?

Is there anything else I can try?

Edit: After loading the blink sketch, then power on/off the board (unplug/plug USB), the boards entered Boot/DFU mode again (solid Green Neopixel and slowly glowing Red LED). I left it next to me while I searched the internet on how to erase the device using J-Link. After a while I noticed the LEDs change, the board started the Blink Sketch; I power on/off the board again and it enters DFU mode, so start a timer and then after 5 mins the board starts the Blink sketch. So the problem seems to be something wrong at power-up, something making the board enter Boot mode. I have no external hardware connected, no pins are grounded, this happens when powered by USB, or only by 3.7V battery.
The board always enters Boot mode at power-on, but times out after 5 mins and runs the Arduino sketch.

How can I do a full reset/recovery of the NRF52? Erase and reset back to factory settings, program the softdevice and bootloader again?

Regards.

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Sat May 08, 2021 8:20 pm

Thank you for taking the time to install CircuitPython and doing the storage wipe. Bummer that it didn't resolve the boot to DFU.

The closest guides we have to get you back to factory settings on a Feather nRF52840 would be the steps you have already followed well. Drop in a new bootloader --> Install CircuitPython Release --> erase the flash and re-up the code. This doesn't resolve any possible fuse settings and do a complete erase.

Using a jlink will provide you a way to erase the flash
Code: Select all | TOGGLE FULL SIZE
nrfjprog -e


Code: Select all | TOGGLE FULL SIZE
nrfjprog --program bootloaderfile.hex
to push the bootloader back up.

Definitely, worth having a JTAG programmer around to help with compromised devices. Was this the forum post you were looking at:

viewtopic.php?f=57&t=176836&p=861757&hilit=nrfjprog+recover#p861757

Good observation about the blink code briefly running. Does the same behavior occur when you run off a USB wall plug (not using a PC USB port).

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help: NRF52840 always power on in DFU mode

by Ashfox on Sun May 09, 2021 6:17 am

@mikeysklar

I tried many different ways to power the board, USB from a battery bank, 3.7V battery, then using an external bench supply, 5V to VUSB, and then 3.3V directly. When supplying from a bench supply, I scoped the supply at start-up and also observed the Reset pin, all appears normal - I don't think this is the issue.

I don't yet have a J-Link adapter, but I just ordered one from Mouser, may take a few days to arrive.
On the Nordic forums I also came across the following, a recovery mode, which erases user code and UICR flash areas (whatever that means). I have installed the command line tools, but I'm not sure how to run the commands in windows command prompt, any guides on this?

nrfjprog --recover

I will let you know how I get on and which commands, if any can resolve the power-on to Boot/DFU problem. However I want you know (not you personally: but Adafruit) that my start-up project has been crippled for weeks due to this issue and I don't have a lot of time. For whatever reason, my Arduino BLE application code based on Adafruit examples, is repeatedly corrupting the NRF52840 express boards - 3x so far. Each time they fail I have to dismantle and rebuild the prototypes with new boards, this can't go on.

I will, at my own expense, try the J-Link debugger adapter, but if that doesn't work, then I want to return these boards for an exchange to the nRF82832 board, which I think is less likely to develop this issue, since my first prototype used this board and after a several months, it's still working okay. I regret 'upgrading' to the NRF82840.

Best regards

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Sun May 09, 2021 2:40 pm

Our guide mentions an eraseall option for the nRF52's as well to be used with nrfjprog.

https://learn.adafruit.com/circuitpytho ... 2991996-21

Code: Select all | TOGGLE FULL SIZE
nrfjprog -f nrf52 --eraseall


A little more on manually burning nrf52 bootloaders with the Particle Argon as an example.

https://learn.adafruit.com/circuitpytho ... -3014515-4

Glad you are working with the jlink to explore the issues.

We won't be able to work with you on a return for any nRF52's unless they were purchased from us in the last month.

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Re: Help: NRF52840 always power on in DFU mode

by Ashfox on Sun May 09, 2021 4:01 pm

@mikeysklar

Understood, I'll report back when my J-Link adapter arrives. One more question, would you recommend using the latest version 0.5.0 bootloader, or using the 0.3.2 release which is what the boards were shipped with? For Arduino sketches, is one more stable than the other?
NB: I tried updating to 0.5.0 and reverting back to 0.3.2. and neither solved my issue.

Regards

Ashfox
 
Posts: 10
Joined: Fri Jun 19, 2020 5:27 am

Re: Help: NRF52840 always power on in DFU mode

by mikeysklar on Mon May 10, 2021 3:38 pm

Please continue to only use the latest nRF52840 bootloader 0.5.0.

I'm glad you mentioned the bootloader again. I looked back through the issues and there is are multiple closed CRC checksum address issues which can cause you to get stuck in DFU mode.

https://github.com/adafruit/Adafruit_nR ... issues/115

it is not a new bug, it is CRC checksum of bootloader, you should either flash the CRC16 of the application or disable the checking by writing 0x0001 (if I remembered correctly) to bootloader crc checking address (forget the exact address). Since you just erase and flash with jlink, simplest way is perfrom an DFU via serial or uf2, it iwll write the disable magice to crc checking.


More details here on working around the CRC using different command line tools + jlink.

viewtopic.php?f=57&t=167184&p=819095&hilit=nrf52+crc+checksum#p819095

mikeysklar
 
Posts: 4591
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.