AVR to PC communication through USB

Thread Starter

dsp_redux

Joined Apr 11, 2009
182
Hi,

I'm working on a project using an ATMEGA32U2 (http://www.atmel.com/dyn/resources/prod_documents/doc7799.pdf) which already has a USB controller in it. From what I understand, I need to set USBE=1 (USB enable) to initialize the USB controller. Then... what? Let's say I have informations in internal EEPROM, do I just go and plug the PC and AVR through USB and that's it? The PC will see the info just like a USB key?

I know it can't be that simple, but where do I go from there?
 

Thread Starter

dsp_redux

Joined Apr 11, 2009
182
That was my B plan.
Rich (BB code):
if(NB_ANS_AAC_FORUM == 0){
        OPEN_ACCOUNT("AVRFREAKS");
        ASK_QUESTION();
        HOPE();
}
else {
        BE_HAPPY_WITH ONLY ONE ACCOUNT();
}
Sooner or later, I'll have to register an account there :p.
 

Papabravo

Joined Feb 24, 2006
21,225
Doing a USB interface will be way more complicated than you can possibly imagine. Go to www.usb.org and download the documents there. In order to talk to a PC you will have to go through a process called enumeration. Every time you answer incorrectly the PC will shut down the connection leaving you to wonder what your mistake was. WORSE your registry will contain corrupted information that will require manual deletion so that the enumeration process can be started over with a fresh slate.

If you don't have a USB traffic analyzer, such as a Beagle, get one! You have no chance to debug the enumeration process without one.
 
Last edited:

Thread Starter

dsp_redux

Joined Apr 11, 2009
182
I agree that the USB 2.0 spec needs some time before it can be digested. Or I use something like LUFA, or I byte the bullet and go through this. Since time on this project is not critical, I guess I'll do what Supertramp tells me, I'll take the long way home.
 

Papabravo

Joined Feb 24, 2006
21,225
I agree that the USB 2.0 spec needs some time before it can be digested. Or I use something like LUFA, or I byte the bullet and go through this. Since time on this project is not critical, I guess I'll do what Supertramp tells me, I'll take the long way home.
LUFA??, Supertramp?? What are they?
 

Papabravo

Joined Feb 24, 2006
21,225
Do you have the AVR-GCC compiler up and working?
I think understanding LUFA well enough to use it may present it own challenges.
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
From what I understand, I need to set USBE=1 (USB enable) to initialize the USB controller. Then... what?
Depends on how familiar you are with the USB protocols. If you check on the Atmel website, you'll find several examples of USB code in the evaluation board sections.

On the PC side, there are a number of tools that provide direct access to USB devices. I've found that Labview has an excellent set of tools for working with USB devices.
 
Top