General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
-
Mario
Post
by Mario » Tue Nov 20, 2007 12:50 pm
Hi,
I have a simple questen (and I hope that the answare is simple too

).
Anybody knows if there is a way to detect if the USB cable ist connectet, and the enumeration is done successfully, by firmware? I don't have more pins available on my ATmega32 to detect the USB cable, so I'm trying to do it by software.
By the way, I'm working with the firmware of PowerSwitch.2007-03-29. Should I do a update to the newer version? My device is working fine, but I read something about problems wich appear sporadically (USB connection fails after some hours inactive), with the older version.
Regards,
Mario
-
christian
- Objective Development

- Posts: 1443
- Joined: Thu Nov 09, 2006 11:46 am
Post
by christian » Tue Nov 27, 2007 10:57 am
You can check for SOF frames which come in 1 ms intervals if the device is connected to a host. The easiest way to do this is to (1) wire INT0 to D- instead of D+, (2) update to the latest driver version and (3) define USB_COUNT_SOF in usbconfig.h.
Then you can check whether the global variable usbSofCount increments every millisecond.
-
Guest
Post
by Guest » Tue Nov 27, 2007 7:52 pm
Hi Christian,
thank you for your answare. Just one more question, where I should connect D+, if I connect D- to the INT0? I read in the usbconfig.h that D+ must be connected to INT0.
I'm already using the new driver version. The update was very easy, and the USB-communication still working great.
Regards,
Mario
-
christian
- Objective Development

- Posts: 1443
- Joined: Thu Nov 09, 2006 11:46 am
Post
by christian » Tue Nov 27, 2007 7:55 pm
The newer versions of the driver don't really care whether you connect D+ or D- to INT0. For counting frames, however, you MUST connect D- to INT0 because only D- carries the frame marker.