Author Topic: Bootloader won't disconnect from USB  (Read 6240 times)

Paul Boven

  • Newbie
  • *
  • Posts: 8
Bootloader won't disconnect from USB
« on: May 16, 2013, 05:08:09 am »
Hi folks,

One of my DigiSparks no longer disconnects from USB after 5 seconds. It stays online with the bootloader PID/VID until I unplug it. I can still program it, but after a few seconds it no longer replies on USB, and I can see that the uploaded application is working.
If an application does use USB, the disconnect does still happen and the VOTI PID/VID connection gets made.
Did my bootloader somehow get a tiny bit corrupted? I have not written anything that might alter the bootloader (just using ports, timers, and DigisparkUSB).
Should I try to re-flash the bootloader? 1.02, or go for 1.06 in that case?

Project Idea: an UnBrick-shield with High-Voltage Serial Programming, that you can put a sick DigiSpark on.

dougal

  • Sr. Member
  • ****
  • Posts: 289
Re: Bootloader won't disconnect from USB
« Reply #1 on: May 16, 2013, 06:08:15 am »
Project Idea: an UnBrick-shield with High-Voltage Serial Programming, that you can put a sick DigiSpark on.

Yes. I could use that. I think I bricked one of my sparks when I tried updating the bootloader on a whim. Unfortunately, I think I did it with the LCD shield plugged in, plus I was using a buggy early version of the new IDE. The spark no longer accepts programming, but I'm guessing (hoping?) that it would work again if I could re-burn it.

Paul Boven

  • Newbie
  • *
  • Posts: 8
Re: Bootloader won't disconnect from USB
« Reply #2 on: May 16, 2013, 06:28:19 am »
The way I envision such a shield: a PCB like a regular shield, with a bunch of pins to put into a DigiSpark. Then a second set of pins that point upwards, that you can put the dead DigiSpark on, upside down. The PCB would have a simple voltage upconverter driven by the functioning DigiSpark. Someone already designed this for a 'regular' AtTiny13, so this would be easy to make a shield for.

https://sites.google.com/site/wayneholder/attiny-fuse-reset-with-12-volt-charge-pump

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Bootloader won't disconnect from USB
« Reply #3 on: May 16, 2013, 10:32:38 am »
Paul,


Interesting - If you load a non-DigiUSB sketch on does it disconnect? Say the "Start" example?


I've noticed some behavior where a sketch that runs out of ram or crashes in another way causes the disconnect to never occur.






Regarding the HVSP shield - I have a design for one, just haven't seen the demand for our usual quantities (1,000+ is our usual first run) - but I do hope to produce it in smaller quantities soon as we are setting up to do surface mount in house and it requires a really tiny surface mount IC.

Paul Boven

  • Newbie
  • *
  • Posts: 8
Re: Bootloader won't disconnect from USB
« Reply #4 on: May 16, 2013, 01:54:31 pm »
Yup, that's the odd thing. If I upload something simple like a blink, that does in no way include the USB library, the DigiSpark will stay on the USB bus. The uploaded application runs just fine. An application that does use the DigiUSB library also works fine. So the DigiSpark in question is still quite functional, it's just behaving a bit strangely.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Bootloader won't disconnect from USB
« Reply #5 on: May 16, 2013, 06:45:20 pm »
Very strange - no more ideas here - if it works fine, great - if not drop me an email and we can replace it.


Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: Bootloader won't disconnect from USB
« Reply #6 on: May 17, 2013, 04:36:59 am »
I've seen this happen - where if your computer doesn't happen to ask the digispark any questions, it never notices that the USB stack isn't operating. I'm not sure why this occurs. It's a little confusing. You might be able to make it simulate a disconnect by setting pins 3 and 4 to outputs and digitalWriting them to be low in your blink sketch setup block - hopefully this makes the host computer think the digispark has been unplugged. The bootloader does do a fake unplug like this, but maybe it doesn't do it for long enough?


It doesn't seem to cause anything to break, so I haven't paid much attention to this.

Paul Boven

  • Newbie
  • *
  • Posts: 8
Re: Bootloader won't disconnect from USB
« Reply #7 on: May 17, 2013, 05:34:34 am »
Hi bluebie,

First of all, thanks for the great work on micronucleus.

The odd thing is, this DigiSpark didn't 'forget' to disconnect at first - it only started doing that a few days ago. And I have a second DigiSpark, that still does properly disconnect, when loaded with the same application.

As it works fine otherwise, it's not a biggie, but I did think it important to point out a possible corruption of a bootloader. I have an old USB programmer that does MOSI/MISO, so I will try and read out the bootloader from both to compare, see if that shows any difference.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: Bootloader won't disconnect from USB
« Reply #8 on: May 25, 2013, 06:03:07 pm »
You can't use an ISP programmer to read out the firmware of a Digispark - you need a HVSP programmer to do that, as the reset pin is disabled so you can use pin 5 in your projects. You could write a little program which you upload to the digispark which scans through the flash memory up through to 8kb and writes it out over digiusb or perhaps types it out as hex with
Code: [Select]
DigiKeyboard.print(byte, HEX);