View Full Version : interfacing USB port with AVR

01-10-2006, 08:48 PM
is there is any way to connect AVR(atmega32L ) with the USB port.

Can i do it without any external hardware.

tht means just connecting AVR ports to usb and no chips in between.

If so which language i can do it

Any hardware setting(bios settings)

Bibin John

01-10-2006, 11:28 PM
Plz search the forums/net before posting ( as this has been discussed before ).

01-12-2006, 03:03 PM
if u had done can u give some code

can u give me some code to do in java

I want both way communication

01-12-2006, 05:27 PM

I havent got a chance to work on usb in AVR.... but usb in PIC Rocks...

USB is not like a parallel port or serial port in which you can just send data..... its kind of complicated... and its not at all recommended to touch the physical layer of usb....

u can find example in lvr.com to use it with VB... you can use java with windows api.... the same u will do in vb too....

PIC18f4550 is pretty good with documented example in it. You can also find lots of resources in lvr.com. there is a good tutorial in beyondlogic.com in which he had implemented usb with a philips PDIUSBD11 (usb peripheral controlled by i2c)...

If your datarate is less than 64kbps you can use a HID class in which you dont need to write a single line of driver code. Windows will take care and the device will be just installed. you would be sending the data in the form of reports to the computer and u can use ReadFile API and write file api to write and read device...

"Usb complete" will help you for kickstart.....

so whats ur application.....


01-13-2006, 01:13 AM
actually i wanted it for my project
now i am doing project on embedded ethernet
i wanted to see the packets coming. So i am interfacing atmega32 with computer. So I wanted to USB interfacing. So if someone had done it earlier, why should i reinvent the wheel. That is why i asked for code and all

Anyway thanks for ur information. Let me try is it possible

Bibin John

01-13-2006, 02:17 AM
the .pdf link i gave comes with source ( go search the atmel site ).

01-13-2006, 02:19 AM
the .pdf link i gave comes with source ( go search the atmel site ).

01-13-2006, 01:32 PM

i wanted to see the packets coming

So where do these packets comes from... if it is from another usb device or from yet another ethernet module...?....

if it is coming from module..... what is the use of usb.....?...

You need to have a USB Host....if you are getting the packets from another usb device.....

if you are getting the packets with ethernet module and sending to comp with usb then u need a usb peripheral

Though both sounds same.... it is totally different.....

there are very less no of compact embedded usb host... the good ol atmel is making with 32 bit arm archithecture... microchip doesnt make it.... as always for usb.. cypress has it.... usbwiz seems to be promising.. i have started working in usbwiz only these dayz....

there is no probs for usb peripheral every one makes it.....

Please dont try to touch the physical layer of the usb bus..... y do u want to complicate things.... bit banging is good for i2c, spi, even for serial..... but not for USB......

i may have complicated things.... but i cant make it simpler.......


01-14-2006, 08:32 AM
actually i am doing on connecting atmega32 to Lan
So this uC is receiving packets
i just want to see tht packets on pc
So I thought of USB because it is new to me
This is my final yr project.

01-14-2006, 06:45 PM
I have success fully done this.
These are the links you can refer to:
-- Best AVR site in the World !!!

-- I used this initially use of USB - This later became a AVR appnote

--The Direct chip for USB-to-Serial but not available in INDIA

--Break through AVR USB implementation + Full Sample projects

--USB based AVR programmer using MEga8 Full Source + Schemtics

Hope that this will help you. For further help feel free to contact me.