Procedure to repair a damaged badge DFU (Device Firmware Update) partition.
Parts needed:
- OpenOCD compatible JTAG adapter hardware. (Output shown below were from using a Segger J-Link.)
- Computer with OpenOCD installed.
- Micro USB cable for connecting computer to badge.
- Computer with DFU utility installed. (Debian-based Linux distros can install with `sudo apt install dfu-util`)
- Hackaday Superconference 2019 Badge.
- Bootloader files "bootloader.svf" and "bootloader.bit" from the "Files" section of this project.
Procedure:
- Turn on badge while holding SW7 and SW8.
- Nothing visible on LCD. (If you see DFU screen, damaged DFU is probably not the problem, but you can go through this procedure anyway if you choose.)
- Verify computer attached via micro USB port does not see USB device. (If it does, again damaged DFU is probably not the problem.)
- Connect to badge via JTAG with OpenOCD. (If it does not connect, there are problems beyond DFU.)
Info : JTAG tap: ecp5.tap tap/device found: 0x41112043 (mfg: 0x021 (Lattice Semi.), part: 0x1112, ver: 0x4)
- Initialize OpenOCD, upload "bootloader.svf" to badge RAM, then exit.
> init > svf bootloader.svf [... lots of text trimmed ...] svf file programmed successfully for 58 commands with 0 errors > exit
- You should see DFU screen at this point, but it is only running from RAM and will disappear if the badge is restarted.
- But we should now see a DFU device over the micro USB port, and can use it to write bootloader to flash memory storage.
- Use "dfu-util -l" to list all available locations Look for "Bootloader" and note its number (in this example, 5)
dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=5, name="Bootloader", serial="e4692895a72b5c23" Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=4, name="Cartridge main FS region", serial="e4692895a72b5c23" Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=3, name="Cartridge IPL region", serial="e4692895a72b5c23" Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=2, name="Cartridge ECP5 bitstream", serial="e4692895a72b5c23" Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=1, name="RISC-V firmware (IPL)", serial="e4692895a72b5c23" Found DFU: [1d50:614b] ver=0005, devnum=62, cfg=1, intf=0, path="1-2", alt=0, name="ECP5 bitstream (SoC)", serial="e4692895a72b5c23"
- Upload 'bootloader.bit' to that location specified via the "-a" parameter.
dfu-util -d 1d50:614a,1d50:614b -a 5 -D bootloader.bit
- Once uploaded, the DFU should be back up and running and ready to accept a new SOC, IPL, etc.
DFU mode device DFU version 0101 Device returned transfer size 4096 Copying data from PC to DFU device Download [=========================] 100% 279463 bytes Download done. state(2) = dfuIDLE, status(0) = No error condition is present Done!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.