enumeration detect for AVR?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

enumeration detect for AVR?

Post by iphi » Mon Feb 11, 2008 9:12 pm

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

iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

Post by iphi » Wed Feb 13, 2008 5:59 pm

Think I found the answer in the forum:

usbSofCount

Tom

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

Post by christian » Thu Feb 14, 2008 12:26 am

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.

iphi
Rank 2
Rank 2
Posts: 68
Joined: Mon Jun 25, 2007 11:37 am

Post by iphi » Fri Feb 15, 2008 1:20 pm

the host assigns an non-zero usbDeviceAddress

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

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

Post by christian » Fri Feb 15, 2008 3:47 pm

It's not declared in the header, but you can access it if you declare it yourself as

extern uchar usbDeviceAddr;

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

Post by christian » Thu Feb 28, 2008 11:54 pm

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.

Post Reply