satoshinm / pill_duck

Scriptable USB HID device for STM32F103 blue pill (inspired by USB Rubber Ducky) ⛺
GNU General Public License v3.0
63 stars 17 forks source link

reset of death #13

Open grindhold opened 6 years ago

grindhold commented 6 years ago

i think i found a way to destroy a pill duck.

way to reconstruct:

0) build pill_duck via make 1) start openocd openocd -c "bindto 127.0.0.1" -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg 3) connect to openocd telnet localhost 4444 4) halt the cpu halt 5) flash pill_duck program /path/to/pill_duck.elf verify 6) reset the cpu reset 7) disconnect bluepill from programmer, connect via usb to pc 8) lsusb yields pill duck device descriptor 9) screen -L /dev/ttyACM0 enter j for jiggler and press enter 10) reset device via RESET button 11) unplug the bluepill and plug it in again 12) lsusb wont list pill duck device descriptor anymore 13) unplug from usb and connect to programmer again 13) repeat 3 - 7 15) lsusb will not recognize the device anymore. for good.

meanwhile in dmesg:

[ 1013.422920] usb 2-3: new full-speed USB device number 33 using xhci_hcd
[ 1018.722980] usb 2-3: device descriptor read/64, error -110
[ 1024.098997] usb 2-3: device descriptor read/64, error -71
[ 1024.334969] usb 2-3: new full-speed USB device number 34 using xhci_hcd
[ 1029.475019] usb 2-3: device descriptor read/64, error -110
[ 1034.851068] usb 2-3: device descriptor read/64, error -71
[ 1034.959072] usb usb2-port3: attempt power cycle
[ 1035.611026] usb 2-3: new full-speed USB device number 35 using xhci_hcd
[ 1040.867178] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[ 1041.075235] usb 2-3: Device not responding to setup address.
[ 1041.283022] usb 2-3: device not accepting address 35, error -71
[ 1041.411009] usb 2-3: new full-speed USB device number 36 using xhci_hcd
[ 1046.499103] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[ 1046.707262] usb 2-3: Device not responding to setup address.
[ 1046.915081] usb 2-3: device not accepting address 36, error -71
[ 1046.915170] usb usb2-port3: unable to enumerate USB device

flashing stuff like miniblink still works, so the device does not seem utterly bricked. does anyhone have any ideas how to resolve that issue?

spacerace commented 6 years ago

STLink is connected via SWD or JTAG?

I suggest try a real visual windowed step-by-step debugger. i could give you Keil MDK professional (no limits). Go to debugger and watch clocks etc.

I love those blue pills for 2 or 3 years now :)

//edit: That Keil offer is for Grindhold only, as we know each other in RL.

freexlamer commented 6 years ago

I have the same issue with j- and d- command.

l29ah commented 5 years ago

Complete erase of the STM32 flash fixes the issue for now, but it readily occurs again when you reset it at the "wrong" time.