Page 1 of 1

enumeration detect for AVR?

Posted: Mon Feb 11, 2008 9:12 pm
by iphi
Hi,

is there a function within the AVR firmware which allows the main loop to find out if enumeration was successful?

I'm still thinking about some possibility to do a self calibration of the RC oscillator. One slow but working solution would be to modify OSCCAL until enumeration is successful, then find out the extreme values where enumeration fails and sit in the middle.

Thanks, Tom

Posted: Wed Feb 13, 2008 5:59 pm
by iphi
Think I found the answer in the forum:

usbSofCount

Tom

Posted: Thu Feb 14, 2008 12:26 am
by christian
Hmm... When enumeration succeeds, the host assigns an non-zero usbDeviceAddress. This is a global variable.

With usbSofCount you should be able to calibrate more efficiently, though.

Posted: Fri Feb 15, 2008 1:20 pm
by iphi
the host assigns an non-zero usbDeviceAddress

Is there such a global variable for the AVR firmware, too, that shows that connection was successful?

Posted: Fri Feb 15, 2008 3:47 pm
by christian
It's not declared in the header, but you can access it if you declare it yourself as

extern uchar usbDeviceAddr;

Posted: Thu Feb 28, 2008 11:54 pm
by christian
Just for your information: We have released EasyLogger 2008-02-28 today. This version adds self-calibration of the RC oscillator.

In principle, this calibration algorithm can be used to calibrate the RC oscillator directly to 12 MHz. However, the precision is not high enough for the 12 MHz module (because it does not have a software PLL) and 12 MHz is outside the specified range of OSCCAL values. It's still an interesting field for experiments...

The new AVR-USB also offers hooks to inform the application firmware about USB reset and device enumeration.