Hi!
During the course of the last week, I bricked two Nano 33 BLEs.
The first one stopped responding when I was using Visual Studio Code to develop, and opened the serial monitor while uploading the sketch. Programming stopped, and the device never responded thereafter. On closer examination, it was rapidly connecting and disconnecting as a USB device with my Linux OS.
I then used my MKR Zero and the DAP library to flash the bootloader. After that, at least I now have a USB device with the correct name (Nano 33 BLE) again, but uploading a sketch still fails with "No device found". So that was only half a fix.
I then switched to a second device, but that also didn't last long. As a precaution, I had stopped using VS Code for my Arduino work and switched to arduino 1.8.13. I'm not 100% certain what happened this time, but in the end, I'm left with a device that once more quickly disconnects from USB.
The system log says
usb 1-5.3: new full-speed USB device number 120 using xhci_hcd
usb 1-5.3: Device not responding to setup address.
usb 1-5.3: device not accepting address 120, error -71
usb 1-5.3: new full-speed USB device number 121 using xhci_hcd
usb 1-5.3: New USB device found, idVendor=2341, idProduct=005a, bcdDevice= 0.11
usb 1-5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-5.3: Product: Arduino Nano 33 BLE
cdc_acm 1-5.3:1.0: ttyACM0: USB ACM device
usb 1-5.3: USB disconnect, device number 121
within less than a second.
I don't have access to the MKR Zero right now, so I didn't try uploading the bootloader to the second device, yet. But bricking two devices to quickly gave me enough concern already to post here.
For uploading the bootloader, I'm using the program() method of the Adafruit_DAP_nRF5x class. It takes some three seconds and no errors are reported. The file I'm uploading is packages/arduino/hardware/mbed/1.3.2/bootloaders/nano33ble/bootloader.bin
to address 0. Since the situation with the first device at least improved, that can't be too wrong…
When just uploading the bootloaded didn't work, I added calls to programUICR for the UICR_BOOTLOADER and UICR_MBR_PARAM_PAGE addresses as seen in other upload routines. This led to no observable changes.
So the obvious questions I have:
Why is this happening so often?
How do I fix it for good?
Michael