Arduino Forum

Using Arduino => Microcontrollers => Topic started by: cyclegadget on Dec 15, 2011, 11:37 pm

Title: Could the Atmega 32u be used for USB to RS232?
Post by: cyclegadget on Dec 15, 2011, 11:37 pm
 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.
http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_USB_RS232_CABLES.pdf

I would need these outputs just like the cable specified.
1 GND
2 CTS#
3 POWER*
4 TXD
5 RXD
6 RTS#
Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: cyclegadget on Dec 16, 2011, 02:47 am

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.

Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: Coding Badly on Dec 16, 2011, 02:58 am

If you are willing to give up RS232 or add a TTL-to-RS232 converter, a Teensy would work very nicely.
Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: cyclegadget on Dec 16, 2011, 03:25 am


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.
Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: cyclegadget on Dec 16, 2011, 03:33 am
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.
Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: putyn on Dec 16, 2011, 10:25 pm
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 http://www.obdev.at/products/vusb/index.html

:D
Title: Re: Could the Atmega 32u be used for USB to RS232?
Post by: cyclegadget on Dec 17, 2011, 02:38 am

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.