Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

USB data transfer

Status
Not open for further replies.

dynomyte

New Member
Hello, I am working on a project that needs to be able to send data via USB to another computer. The MCU is a ATMEGA128 and the USB controller is FT232BM. I have really never worked with this type of data transfer before and I was wondering if anyone knows any code resources to find a C example. I really just need somewhere to start.

Also, Do i have to do anything for the UART to USB conversion. the data sheet made it sound like the FT232 took care of all of that.

Any help would be greatly appreciated!
 
I would suggest you not use C unless you have to
look into PYTHON and the pyUSB module

it will make yr life alot easier
 
all the other work on this system is in C. I have been working on this for about 4 months now and the USB interface is the last part that I want to get accomplished. I am fairly fluent in C. I just dont know where to start with the FT232 chip. It is already on the board so i cant change the chip or anything like that. The system works without the USB interface, but I need to output data(pressure, temps, and time) for monitoring and permanent storage.
 
If you wanted easy, you picked the wrong chip. The FT232R is a simpler version and requires no external components.

As for interfacing. I'm not certain if the uC you are using has hardware UART, but I assume it does. It's pretty simple. Connect all the TX and RX pins to the opposing pins on the serial->USB converter. If you need flow control, connect the CTS/RTS lines as well. Then you just talk with regular serial communication with the PC.

If you install the virtual com port drivers on the PC side, you can talk to your uC like it is connected over a standard serial RS-232 port. If you want direct control, you can install their DLL's and use the DLL's to communicate with your uC while using C, VB, or whatever programming language you want on the PC side.

I don't have experience with the FT232BM, but I have been using the FT232R and it's truely a simple easy to use chip.

EDIT: There's alot of extra stuff on these chips to implement a fast transfer bit bang mode, and extra GPIO pins and stuff. Don't let all that confuse you, as it's unlikely you'll need or even want to use any of it.
 
Yeah i wish i could change the chip but that is what is already on the board. I only have 2 I/O lines left so i am not worring about handshaking. Now do i have to do anything with the controller code? or can i do everything through the serial port and the and the software for the chip will take care of updating the controller code.
 
Basicly you communicate to the PC like you are talking over a normal RS232 connection. You don't nned to do any special control codes or handshaking or anything with the uC.

Download the FTDI virtual com port drivers if you want to access your uC like a regular rs232 device. You can just load up Hyperterminal, connect to the virtual com port created and start interacting with the uC, just like you would if it was connected to a serial port rather than USB.

Or you can download the FTDI DLL/driver. With this method you would need to write your own program in VB or whatever to communicate with your IC. It's still simple serial data, but you use the FTDI DLL functions to communicate with the chip. The programming reference is here:
**broken link removed**
Don't be overwhelmed by all those commands available, you don't need most of them.

Anyway, this is the project I did with the FT232R.
**broken link removed**
I have RX/TX/CTS/RTS connected to the chip, but I don't use the flow control right now.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top