Go Down

Topic: USB Communication with ATMEGA2560 (Read 5525 times) previous topic - next topic

harjizzle

I'm working on a new project that requires communication from Windows via a C# program to the ATMEGA2560. I have found and reviewed guides online, but, they assumed I was using the actual Arduino Mega 2560 development board. I already know what to do from the programming/C# side of things, not the selection of how to create the USB to serial communication. This would not be on the development board but rather it's own board which means I don't already have a USB communication chip. From my research, I assume that I need a FTDI chip?

Basically, I need help on what hardware component(s) do I need that would be the simplest and best solution to this project.

I would like to connect the ATMEGA2560 via USB internal header pins on a computers motherboard to allow USB to serial communication with the ATMEGA2560. looks like the FT232RL chip would be perfect for me? I noticed SparkFun sells a breakout board for it, I assume I can follow their schematic (http://www.sparkfun.com/datasheets/DevTools/Arduino/FTDI%20Basic-v21-5V.pdf) and integrate it directly into my project instead of using a breakout board?

cmiyc

Yes you would need a FTDI chip.  Or you could do what the newer Arduinos do, and use a ATmega8u2 (or 16u2) programmed as a USB to Serial Chip.

Either solution works about the same from the C# point of view.  The C# program is just talking to a serial port.  It doesn't care if it is a virtual serial port or a "real" one.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

jwatte

Is there a "u" version of the 2560? Or is 32u4 as "high" as it goes for now?

The "u" chips are nice, because they have a totally separate USB circuit, and you just set yourself up for polling or getting interrupts from each USB endpoint. You need to follow the USB electrical specifications, though, which is hard to do on a breadboard.

AndrewStone

You could use my solution based on a Cypress chip detailed in the open hardware journal http://openhardware.org/journal/2011/11/.  Its tiny, uses simple hardware (if you can do SMT work) and cheap.  The entire thing, including micro-USB port, fits in a PCB area about the size of your thumbnail, with all components on just one side.  The USB serial software I wrote actually talks to the AVR using SPI not UART serial -- it essentially converts the USB CDC-ACM protocol coming from your computer into SPI. 

And although it "looks" (to the Arduino IDE) just like an AVR bootloader, it actually programs the AVR directly as if you were using a device programmer.   This might be an advantage to you (if you need the Serial, or want to change fuses) or it might not. 

Also, Cypress provides some software libraries so the chip can easily mimic usb HUD devices (keyboard, mouse, gamepad). 

But if you do want to hack the Cypress chip (you could just load my stuff on), be forewarned -- it doesn't have easy libraries like Arduino and a huge forum!  Its "real" embedded programming.   And of course you need a Cypress chip programmer which is about 20 bucks.

Cheers!
Andrew

cmagagna

Quote
Is there a "u" version of the 2560? Or is 32u4 as "high" as it goes for now?


There's the AT90USB1286, used in the Teensy++ 2.0. You can program it with Teensyduino, which is an add-on for the Arduino IDE.

Let's see if I can get the HTML right for this...








AT90USB1286ATMega2560
I/O4654
Analog816
Flash128K256K
RAM8K8K
EEPROM4K4K


http://www.pjrc.com/teensy/index.html

Chris



harjizzle

Thank you everyone for the support, I'm ordering the hardware and will conduct tests. It's great to see such a great community here.  XD

Go Up