Program Bootloader of Digispark ATTiny85 with A ISP ProgrammerMar 8th 2021Words: 1.2k
Background
After run micronucleus -run ./upgrade-t85_default.hex on my Chinese clone of Digispark, I successfully break the bootloader so the USB programming interface is no longer available for me.
08.03.2021 22:54:17:742 kernel usb 1-4: new low-speed USB device number 64 using xhci_hcd 08.03.2021 22:54:17:865 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:18:095 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:18:325 kernel usb 1-4: new low-speed USB device number 65 using xhci_hcd 08.03.2021 22:54:18:449 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:18:679 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:18:789 kernel usb usb1-port4: attempt power cycle 08.03.2021 22:54:19:442 kernel usb 1-4: new low-speed USB device number 66 using xhci_hcd 08.03.2021 22:54:19:442 kernel usb 1-4: Device not responding to setup address. 08.03.2021 22:54:19:649 kernel usb 1-4: Device not responding to setup address. 08.03.2021 22:54:19:855 kernel usb 1-4: device not accepting address 66, error -71 08.03.2021 22:54:19:982 kernel usb 1-4: new low-speed USB device number 67 using xhci_hcd 08.03.2021 22:54:19:982 kernel usb 1-4: Device not responding to setup address. 08.03.2021 22:54:20:189 kernel usb 1-4: Device not responding to setup address. 08.03.2021 22:54:20:395 kernel usb 1-4: device not accepting address 67, error -71 08.03.2021 22:54:20:396 kernel usb usb1-port4: unable to enumerate USB device 08.03.2021 22:54:50:095 kernel usb 1-4: new low-speed USB device number 68 using xhci_hcd 08.03.2021 22:54:50:219 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:50:449 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:50:679 kernel usb 1-4: new low-speed USB device number 69 using xhci_hcd 08.03.2021 22:54:50:802 kernel usb 1-4: device descriptor read/64, error -71 08.03.2021 22:54:51:035 kernel usb 1-4: device descriptor read/64, error -71
Solution
Luckily this Digispark I own does not disable the RESET pin(PB5) as the Genuine Digispark does, therefore I still can use the ISP to flash a new bootloader into the ATtiny85.
Tools required
Latest micronucleus command line tool and the ATtiny85 bootloader firmware release from GitHub - Micronucleus
avrdude executable, installed with Ardiono IDE on Linux.
avrdude: Version 6.3, compiled on Jul 7 2020 at 19:38:43 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping
Using Port : usb Using Programmer : usbasp Overriding Baud Rate : 19200 AVR Part : ATtiny85 Chip Erase delay : 4500 us PAGEL : P00 BS2 : P00 RESET disposition : possible i/o RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :
Programmer Type : usbasp Description : USBasp, http://www.fischl.de/usbasp/
avrdude: auto set sck period (because given equals null) avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: AVR device initialized and ready to accept instructions
avrdude: verifying ... avrdude: 8166 bytes of flash verified
avrdude: safemode: hfuse reads as DF avrdude: safemode: efuse reads as FE avrdude: safemode: Fuses OK (E:FE, H:DF, L:F1)
avrdude done. Thank you.
Unplug and plug in the Digispark again, and now the device is recognized correctly.
1 2 3 4 5 6
08.03.2021 23:05:02:612 kernel usb 1-4: new low-speed USB device number 77 using xhci_hcd 08.03.2021 23:05:02:751 vmware-usbarbitrator USBGL: kevent: adding USB device 1-4 08.03.2021 23:05:02:752 kernel usb 1-4: New USB device found, idVendor=16d0, idProduct=0753, bcdDevice= 2.05 08.03.2021 23:05:02:753 kernel usb 1-4: New USB device strings: Mfr=0, Product=0, SerialNumber=0 08.03.2021 23:05:02:770 mtp-probe checking bus 1, device 77: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4" 08.03.2021 23:05:03:347 mtp-probe checking bus 1, device 77: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4"