I have a Digispark model A with USB permanently connected to a Zotac BI320 running Windows 10. Digispark function is turning digital outputs on and off in response to characters sent over the USB, via the send.exe supplied with the IDE.
It normally runs fine, but if AC power fails and is later restored, the Digispark shows as Unknown (device descriptor read failed). The Zotac powers its USB ports whenever AC power is present. The BIOS is set to automatically boot when power is applied.
Once the device shows as unknown, rebooting the PC (or shutting it down then manually pressing power) does not help. During this time, although the USB interface is nonfunctional, Digispark application code is otherwise running "ok". Unplugging and reconnecting the device brings it back online.
Strangely, once the Digispark is working, it will survive rebooting the PC (or shutting it down then manually pressing power).
As a test, I added code to setup() that blinks the LED for 60 seconds, before DigiUSB.begin() is called. With this mod when it's working, Device Manager shows 'Digispark Bootloader' while the light is blinking; it changes to 'DigiUSB' when DigiUSB.begin is called. When it's not working, Windows boots up and I can log in, start Device Manager and see 'unknown device', all while the LED is still flashing, yet the call to DigiUSB.begin does not get the interface started.
Though I've read that the reset pin is disabled (so it can be used for user I/O), on my unit pulsing it low does reset the ATtiny and it recovers from the unknown device issue. So, I was thinking of putting some sort of keep-alive function in the app -- if it gets no commands from the PC for e.g. one minute, it would reset itself. However, I have a few questions:
1. Is this reset function dependable (is it supposed to be disabled, will a future release disable it)?
2. Can I activate it by writing PB5 low, or would hardware be needed?
3. Can I just "jump into the bootloader" instead? Or, is a hardware reset likely needed?
4. Is there a better way to bring the Digispark back on line?
Thanks,
Stewart