adafruit / Adafruit_nRF51822_Flasher

Wrapper for the Segger J-Link or STLink/V2 (via OpenOCD) to flash nRF51822 MCUs
41 stars 11 forks source link

Faulty chips pass undetected #5

Open delta512 opened 4 years ago

delta512 commented 4 years ago

Hello, I'm writing this after one of the two Bluefruit LE UART Friends came completely dead.

What: Me and my team are trying to setup a wireless link using two of such modules to achieve remote sensing for an exam project and bla bla bla...

I know they can't work in central mode and we should have chosen something else, but we were in a tremendous hurry. Long story short, I'm re-flashing them with a spare ST-LINKv2 I own and the setup is working perfectly with one of the modules.

Once happy with some tests, I moved on to setup the second one, just to find out this module showed no sign of life, no blinks, no signal... just dead. So I promptly cranked up openocd, searching for some signs on the chip's ECG...

Insight: OpenOCD started without complaining and I could reset init the chip succesfully. Then I issued an nrf51 mass_erase command, getting back an error about an unrecognized device of HWID 0x000000d6.

Left in despair, I tried to flash my firmware anyway... no error, none at all, and my problem was solved! But that quirk left me wondering about future failure possibilities... Fast-forwarding all my searches, turns out 0x00d6 is not a valid Hardware ID among nRF51822s (the other one being a proper 0x0083, as of src/flash/nor/nrf5.c from the OpenOCD source code)

I suppose the flashings went okay just because ihex files contain addresses from a well set up toolchain already and do not need extra info like the chip ID.

TL;DR As you say in the tutorial page, nRF51822 Flasher is a tool you use in production, so a proper check at this stage https://github.com/adafruit/Adafruit_nRF51822_Flasher/blob/ca606ce6fe82219cf6a66ca7d764ee0245696b28/flash.py#L90-L95 may help you spotting failed chips long before they go on a trip around the world.

Maybe just manually re-flashing would do for some customers, but a bad factory-written register suggests there's more trouble to come...

Hope this can help!

hathach commented 4 years ago

thank you very much for putting effort to write up this issue. I am sure our production staff will find this useful in the production run :)