OpenSK icon indicating copy to clipboard operation
OpenSK copied to clipboard

LED flashing light blue after flashing, cannot enter DFU mode

Open Tiebe opened this issue 3 years ago • 1 comments

Expected Behavior

Being able to use OpenSK after flashing

Actual Behavior

Led flashing light blue rapidly, cannot enter DFU mode by pressing the button while plugging in.

lsusb output:

Bus 003 Device 053: ID 1915:521f Nordic Semiconductor ASA OpenSK

dmesg output:

[ 4676.899717] usb 3-1: new full-speed USB device number 53 using xhci_hcd
[ 4677.081222] usb 3-1: New USB device found, idVendor=1915, idProduct=521f, bcdDevice= 0.01
[ 4677.081233] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4677.081238] usb 3-1: Product: OpenSK
[ 4677.081242] usb 3-1: Manufacturer: Nordic Semiconductor ASA
[ 4677.081245] usb 3-1: SerialNumber: v1.0
[ 4677.085530] hid-generic 0003:1915:521F.0031: hiddev96,hidraw6: USB HID v1.10 Device [Nordic Semiconductor ASA OpenSK] on usb-0000:00:14.0-1/input0

Steps to Reproduce the Problem

  1. git clone https://github.com/google/OpenSK.git
  2. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
  3. source $HOME/ .cargo/env
  4. cd OpenSK
  5. ./setup.sh
  6. ./deploy.py --board=nrf52840_mdk_dfu --opensk --programmer=none
  7. python3 uf2conv.py -c -f 0xada52840 -o target/opensk.uf2 target/nrf52840_mdk_dfu_merged.hex
  8. Copy opensk.uf2 to usb dongle

Specifications

  • Version: a79abc2
  • Platform: nRF52840-MDK

Tiebe avatar Sep 18 '22 20:09 Tiebe

Works for me on a fresh MDK. Maybe you need to erase the persistent storage, and the blinking is a panic. In that case, follow the instructions above again, but instead of flashing OpenSK, you install the example app that erases all storage. WARNING: Erases all existing credentials, in case you have any important ones.

./deploy.py --board=nrf52840_mdk_dfu --programmer=none --erase_storage
python3 uf2conv.py -c -f 0xada52840 -o target/opensk.uf2 target/nrf52840_mdk_dfu_merged.hex

Then copy and replug. Give it a few seconds to complete erasing the storage. Then try again with --opensk instead of --erase_storage:

./deploy.py --board=nrf52840_mdk_dfu --programmer=none --opensk
python3 uf2conv.py -c -f 0xada52840 -o target/opensk.uf2 target/nrf52840_mdk_dfu_merged.hex

Replug and please report back if that changes anything.

kaczmarczyck avatar Sep 20 '22 10:09 kaczmarczyck

Would love to try this, but I can't even enter dfu mode, so I can't flash anything

Tiebe avatar Oct 01 '22 18:10 Tiebe

Ah right, understood. Is this problem OpenSK related, because you can't enter DFU mode since you flashed an OpenSK, and it worked before?

kaczmarczyck avatar Oct 03 '22 04:10 kaczmarczyck

That's correct

Tiebe avatar Oct 03 '22 05:10 Tiebe

In that case, I'll have to understand how to reproduce. Please let me know if you have any pointers etc. about that.

kaczmarczyck avatar Oct 03 '22 06:10 kaczmarczyck

I had the same problem. Flashing LED and unresponsive bootloader.

If you have a Raspberry Pi you can use OpenOCD to re-flash the UF2 bootloader.

I followed the instructions here https://www.rototron.info/circuitpython-nrf52840-dongle-openocd-pi-tutorial/

It is for the PCA10059 dongle but the process is the same. The only difference is the location of the SWDCLK and SWDIO pins. The pinout can be found here https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/#pinout-diagram

Heed the warnings about resetting the voltage regulator.

The latest 0.7.0 UF2 bootloader for the MDK is here: https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.7.0/mdk_nrf52840_dongle_bootloader-0.7.0_s140_6.1.1.hex

Only flash the bootloader and skip installing CircuitPython at the end.

OpenSK ran fine with the fresh bootloader.

chimpnz avatar Oct 17 '22 03:10 chimpnz

Thanks for helping! Do you know if the unresponsive bootloader was caused by OpenSK? @chimpnz

kaczmarczyck avatar Oct 17 '22 09:10 kaczmarczyck

Thanks for helping! Do you know if the unresponsive bootloader was caused by OpenSK? @chimpnz

Not really sure. I tried to reproduce it and can not. The MDK dongle that had the issue had CircuitPython and LOGItacker installed previously. I tried again loading both via UF2 and then OpenSK and the bootloader remains functional.

I tried another MDK dongle with the original bootloader (UF2 Bootloader 0.2.13-42-g82464f9-dirty) with CircuitPython/LOGItacker/OpenSK and bootloader works fine.

One odd thing is that CircuitPython will no longer run on either dongle. I can copy the UF2 file but it does not run after reset. Tried several versions. LOGItacker and OpenSK run fine.

chimpnz avatar Oct 17 '22 17:10 chimpnz

Can you confirm which branch you're using? stable or develop? The original issue is against stable.

Considering the dongle has been used before, this is what may have happened:

  • other apps have configured the UICR NVM registers a specific way for their usage
  • OpenSK at boot up checks that the reset pin and the voltage regulator (stored in UICR) are configured correctly code
  • if not it wipes out the UICR values to put them in a known state
  • this has the side effect of erasing the values used by the DFU/U2F bootloader

In develop branch we removed that part of the code to avoid such issue and we also have a patch to protect these 2 bootloader values.

But the develop branch is not always tested with the MDK dongle so it might not work out of the box if we haven't properly kept the board configuration.

If you're using the stable branch, we can try backporting the patch to see if this solves the issue.

jmichelp avatar Oct 17 '22 17:10 jmichelp

I am using the stable branch.

chimpnz avatar Oct 17 '22 17:10 chimpnz

I erased and flashed the UF2 bootloader. CircuitPython will load an run. After loading OpenSK, CircuitPython will no longer run.

chimpnz avatar Oct 17 '22 18:10 chimpnz