Difference b/w Atmega8u2 and Atmega8?

Hi,
I googled around a bit on this but couldn't come up with much.
I know that Atmega8u2 is the USB to serial convertor for arduino. It lets the computer know that the device connected is an arduino and handles all the data going back and forth between arduino and PC.
What I can't understand is that what is the difference between this IC and Atmega8? Why can't we use Atmega8(or 16 or 32) to do what it does?

-Antzy

Antzy:
Why can't we use Atmega8(or 16 or 32) to do what it does?

Why would you want to? The processors are about the same price and the ATmega8U2 has built-in support for USB.

Atmega8/16/32 does not have USB electronics built in.

You can find & review the datasheets for them here

The thing is Atmega8 is easily available and more popular.
Can't we emulate the USB hardware in atmega8u2 in software, like used by USBtinyISP to connect to PC via USB? I want to know if it's feasible. Doesn't matter if the performance might be low, implementing very complex code and requiring more space.

Look at the datasheets for the 2 parts, and decide if that might be possible.
I'm off to bed...

Antzy:
The thing is Atmega8 is easily available...

How many do you need? DigiKey has more than 10,000 ATmega8U2 processors ready to ship. Seems "easily available" to me.

...and more popular.

Prove it.

Can't we emulate the USB hardware in atmega8u2 in software, like used by USBtinyISP to connect to PC via USB?

Can't we emulate the USB hardware in software

yes, within limits. Low speed rather than full speed, and not actually meeting USB specifications. Suitable for hobby projects and experimental engineering gear, but not for a product (like Arduino) that you want to sell at Radio Shack and other retail outlets.

It's been done. There's a thread here: http://www.roboticsindia.com/showthread.php/2922-ARP-Affordable-USB-Arduino-Freeduino-based-Boards
Apparently in India, ATmega8 chips were available very cheap, and FTDI chips were nearly unavailable. So these guys implemented an ATmega8-based Arduino using a second ATmega8 as the USB/Serial converter. I gather that it worked OK, but ultimately failed because the low prices of the ATmega8 were more of a temporary glitch in the marketplace than a real savings. (since then, prices of the 328P have dropped considerably, and the mega8 prices ... not.) At least in the US.

I'm in India. Not going to pay $40 for shipping for 1 ATmega8u2 :slight_smile:

Prove it.

westfw's comment proves it. In local shops, we get Attiny and generic Atmegas(that too in few select shops). Very hard to find 8u2 or FTDI cables. I couldn't even find an Arduino in Delhi to replace my dead one(which I bought from another city)! They only had clones. Neither do we have option of buying electronics online (unless we're ready to pay double). :disappointed_relieved:

Thanks for the links Coding Badly and westfw. Seems the project which westfw provided used V-USB based AVR-CDC code in Coding Badly's link to implement USB to serial... If I can't find a fairly priced FTDI cable, I'll give that a try for some homebrew arduino.

You can also make an Arduino (at least theoretically) with nearly any other USB/Serial (TTL) converter. CA42 cell-phone cables are supposed to work (you may not be able to get autoreset to work with these.)

This person claims to (almost) have it working...

The "metaboard" that Coding Badly links only uses a single ATmega, running USB on the same CPU as the sketch.
This is similar to Leonardo (but harder, since it's all software), and is significantly different than using a separate AVR to do JUST the USB/Serial conversion, with an otherwise "standard" AVR to run the sketch.