sparkfun / SF32u4_boards

Support files for SparkFun's 32u4-based Arduino-compatible development boards.
70 stars 75 forks source link

Bootloader 8 Second Delay Not Working Properly #17

Closed CircuitSerialKiller closed 8 years ago

CircuitSerialKiller commented 9 years ago

Some systems need more time to enumerate USB attached devices in order for the Arduino upload process to detect. The implementation of an ~750ms delay change to an ~8 second delay in the bootloader when either grounding the reset pin 2x rapidly, or upon 1200 baud USB serial init does not work properly. I've recompiled the Pro Micro's bootloader using the unmodified Caterina.c and SparkFun's Pro makefile and that works fine with a sufficient delay to use the Arduino loader to upload code. I'm testing with an 8MHz 3.3v Pro Micro ATMEGA32U4 MU on a couple different systems.

I have not completely dug through the modified Caterina.c file yet to determine the incorrectly implemented code, though I have attempted to change this:

if F_CPU == 8000000

define TIMEOUT_PERIOD 4000

define EXT_RESET_TIMEOUT_PERIOD 375

else

define TIMEOUT_PERIOD 8000

define EXT_RESET_TIMEOUT_PERIOD 750

endif

to this:

if F_CPU == 8000000

define TIMEOUT_PERIOD 14000

define EXT_RESET_TIMEOUT_PERIOD 3750

else

define TIMEOUT_PERIOD 8000

define EXT_RESET_TIMEOUT_PERIOD 7500

endif

And after rebuilding and uploading, there was no difference in the timing!

mhord commented 9 years ago

Typically this is only an issue the first time the system has to re-enumerate; on subsequent iterations enumeration happens more quickly. What OS are you using?

CircuitSerialKiller commented 9 years ago

I've got one running XP, the other is Windows 7, but has the CSR bluetooth driver that slows USB enumeration. Either way, the timeout periods in the modified Caterina.c file aren't delaying like in the original Caterina.c. With the modified Caterina.c I see the bootloader come port show up for about a second after a manual double reset or 1200 baud reset.

sej7278 commented 8 years ago

as i recall the 8sec delay is only removed when using a hardware reset i.e. when pressing the button, not a software one i.e. the 1200baud trick

so hardware reset takes 750ms, software still takes 8secs, seems a bit silly really, especially as there is no reset button on the pro micro.

CircuitSerialKiller commented 8 years ago

sej7278 - you have the timings reversed. The hardware reset is supposed to provide 8 seconds, software 750ms. The lack of a reset button saves expense and space. All it does is ground the reset pin on the chip anyhow, which you can do with a wire to the RST pad on the board.

ToniCorinne commented 8 years ago

Please double check our updated board files in the this repository. If you are still having issues, please open a new issue there.