Detect Master presence?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Danny
Posts: 2
Joined: Mon Jan 26, 2009 3:53 pm

Detect Master presence?

Post by Danny » Sun Feb 15, 2009 11:25 pm

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.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Mon Feb 16, 2009 4:24 pm

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.

Post Reply