Page 1 of 1

Detect Master presence?

Posted: Sun Feb 15, 2009 11:25 pm
by Danny
Hi,

I have modified USBasploader so that the bootlader waits approx. 8 seconds before launching the existing firmware. I used the watchdog on the atmega88 for this purpose. This works fine but isn't portable to an atmega8 since the max watchdog time-out on that is 2 seconds. I have tested a 2 second time-out and it seems a little too short. Or perhaps the chances of missing the 2 second window are to big :wink:.

The purpose of this modification is to allow access to the bootloader without setting a jumper. I prefer the 8 second wait after a reset over the hassle of adding or removing a jumper.

Anyway, i'm looking for another solution for the atmega8 and i was wondering if there is a function or variable that i could check to see if there is a master present? I would like to use this check to either enter usbasp programmer mode or leave the bootloader.

Regards, Danny.

Posted: Mon Feb 16, 2009 4:24 pm
by christian
If a master is present, there will be a SOF pulse every 1 ms on D-. If you connect D- to the interrupt and set USB_COUNT_SOF in usbconfig.h, you'll see whether usbSofCount increments.