Could the Atmega 32u be used for USB to RS232?

I would like to have a UC that could run a program then, when needed could act as a USB to RS232 converter. The connections would be, "computer >> standard USB cable >> Atmega board >> wires >> RS232 device". I want to avoid using any inverter, or RS232 chips if possible.

The voltage would be 0v=logic 1, and 5v+ = logic 0 and I would need it to act just like this cable from FTDI.

I would need these outputs just like the cable specified.
1 GND
2 CTS#
3 POWER*
4 TXD
5 RXD
6 RTS#

To help the thought process, I have found that the ATMEGA8U2-MU found on the Uno and the Mega nearly does what I am trying to describe. Although, it is probably not RS232 but rather TTL.

I have never seen the code or hex for the ATMEGA8U2-MU so, I don't know if I can use it for a base to other processors or not.

If you are willing to give up RS232 or add a TTL-to-RS232 converter, a Teensy would work very nicely.

Thanks for the suggestion.

I am wanting to use enough pins, and memory that I think I need an Atmega 328 or 32u.

However, if you could direct me to the code to run the Teensy as you mentioned, maybe I could adapt it to another UC.

....woops the teensy has the 32u now that I think of it. I still need code though.

Thanks to Coding Badly!!!

I got to looking, and I may have found what I need!

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

I may still need an inverter to make RS232 but, I can live with that.

you can make an virtual serial port with most of atmel micros http://www.recursion.jp/avrcdc/cdc-232.html#schematic its based on vusb - software implementation of usb port on atmel micro V-USB - A Firmware-Only USB Driver for Atmel AVR Microcontrollers

:smiley:

Thank you Putyn. They do have a set-up similar to what I was describing. However, I want the USB to RS232 feature to act as a function. The Teensy seems to be easier for the job as they have the code made in a way I think I can understand. My plan is to have the micro controller run a code that would be using serial and I/O pins then, with a flip of a switch or the connection of a computer the UC would become a serial port to my computer. This would allow the computer to connect to the device without needing addition boxes or connectors to be made-up.