Reuse USB port on Arduino for other tasks

Hi there,

I am sure this question was asked before, but spending a considerable amout of time, I was unable to find an answer.

Can one use the existing USB port on the Arduino for USB communcitions with a USB host, For example converting an arduino to be used as a USB flash disk? In this case the USB port would be accepting/expecting read/write commands for a FAT16 device and not for programming control signals from the IDE.

If so, how can one reprogram the Arduino, as the USB port would be programmed to communicate with a USB host for a specific task. Would the IDE build command put the arduino in a mode that it accepts HEX code to be reprogrammed?

Thanks, Moe

The USB on the Arduino is not able to be modified. It is attached to an FTDI Serial Port Emulator chip. The SYSTEM and the ARDUINO do not “SEE” the USB port as much as they see a SERIAL PORT. And a serial port is all it will ever be.

You would need to use different approach… like http://www.obdev.at/products/avrusb/index.html to create a USB device… but then you would be giving up on the ARDUINO method and just using an ATMEL device as a basis for USB development. The OBJDEV solution would leave little room for booloader and arduino code.

Thanks PWillard. Your input is greatly appreciated.

So if I wanted to use the Arduino board as USB device, I would need to add an external USB FTDI <=> [UART] device/componenet which will connect to the Arduino Transmit and Receive pins?

Is that correct?

Thanks,
Moe

No, that's the part you already have. The Arduino bootloader code is designed to send/receive SERIAL data for programming and interaction with the PC (serial monitor). It's best to just leave that alone and ignore the fact that is is USB. The USB version of the arduino is popular because the original serial port is going away on most modern equipment.

It's much more complicated to satisfy the USB specification for FAT devices or HID devices.

You might want to read this stuff: http://www.usb.org/developers/docs/

You would need to use different approach… like http://www.obdev.at/products/avrusb/index.html to create a USB device… but then you would be giving up on the ARDUINO method and just using an ATMEL device as a basis for USB development.

I think this is where I’m supposed to step in and suggest looking at my integration of Arduino and AVRUSB. :slight_smile: I haven’t tried any mass storage device–and strictly speaking it’s not supported by the USB 1.1 low-speed spec–but you might be able to make some progress.

The OBJDEV solution would leave little room for booloader and arduino code.

Actually, the Obdev code only takes about 2KB–it can fit on a much smaller device than an Arduino.

–Phil.

:-[ Of course... this is where I smack my head and remember that I was using the OBJDEV code on a SMALL DEVICE and that's what I remember. oops.

Taking it another direction, I just got my prototype PCBs for something like this. Basically it takes another microcontroller with the AVR-USB code and slaps it on top of the Arduino...on the physical level, rather than the software level. This will leave a lot of CPU time available on the Arduino in case you need to do other things like signal processing, and will work with unmodified Arduino software. However, follower's solution is definitely best for minimal external hardware or Arduino devices with other physical formats.

PWillard,

Just to confirm what I stated, I would think that one could do the following:

  1. [USB-Arduino].UART.Pins <=> FTDI.UART.Pins (new chip, not Arduino’s)

  2. FTDI.USB.Pins <=> USB_Conector.Pins <=> PC (new USB connector, not Arduino’s)

  3. USB_Conector <=> PC

With this configuration, the EEPROM on the Arduino could be used as a Flash Drive?

The confusion comes in when you stated that ‘No, that’s the part you already have’, when I stated to add a new FTDI chip. I also thought that the Arduino’s URATS are not being used for programming but rather the special program pins were.

Where am I missing it? Does the USB of the Arduino connect to the UART of the chip?

Thanks,
Moe

None of that will work, so no, you can't. Also, you're talking about putting a FAT16 filesystem in less than 512 bytes of EEPROM space.

There is no "USB of the Arduino", there is only serial. The UART is being used to download the code, using a bootloader.

I would suggest reading this page before asking more questions, it should provide a better baseline of knowledge for you to move forward: http://arduino.cc/en/Main/ArduinoBoardDiecimila

Got it. Thank you for confirming my misunderstanding. Seems like a waste of a UART if one can't program against it.

People use the UART all the time! It's the primary method used to communicate with an Arduino. On the Diecimila and Duemilanove the UART happens to be attached to the FTDI USB-to-serial converter. This means it looks like a serial port on the computer when you plug it into a USB port. This was explained in the link I posted.

To make a simple example, when one does a serial.print command in an Arduino sketch, the message is sent to the PC via the serial USB connection to the PC and can be monitored with the IDE serial monitor or any terminal emulation program that is set to 'listen' on the com port # that the Arduino USB chip activates, or even to any custom PC application program you might create that can link to a com port.

So the hardware UART in the AVR chip and the USB serial convertor chip are avalible for use in a running Arduino program (sketch), so it is not a wasted resource used only to upload new programs.

Lefty

Ok, I think we are missing each other on this one. I thinks its abvious that I am not an expert on this hardward. Also, I have read up on the links including in this thread.

Something stated in this post is not making sense to me. I 100% conceed that the “EXISTING” USB and FTDI chip can NOT be used for other than programming the Arduino; what’s more the Arduino can NOT be used a FAT16 Flash Drive. Ok with that said.

Why can’t one connect the TX/RX pins on the Arduino (we are talking about pins 0 and 1 mind you) to a TOTALLY OFF BOARD FTDI? Such as this little guy .

Sorry for beating a dead horse, but when something doesn’t seem right to me, there is nothing I want to do more than to take it to the end… and if this projects get off the ground, I’ll make a BOMB and that’s when things start to get really interesting… (for those that take it the wrong way Battery Operated Message Board)… you can put the phone down and or cancel the email to Homeland Securlty.

Special thanks too all those who have taken the time and had enough patients to respond and explain the details. I know how difficult it can be, cause I often talk to myself and it frustrates me like crazy.

Thanks,
Moe

Something stated in this post is not making sense to me. I 100% conceed that the "EXISTING" USB and FTDI chip can NOT be used for other than programming the Arduino;

That is a false statement. The existing USB/FTDI/Arduino pin 1&2 UART CAN be used for general serial communications under program control between the Arduino and the PC, after the sketch has been uploaded and the IDE closed out and whatever PC application is used to talk to the Arduino is launched.

Lefty

Why can't one connect the TX/RX pins on the Arduino (we are talking about pins 0 and 1 mind you) to a TOTALLY OFF BOARD FTDI? Such as this little guy

Because the ONLY thing that the FTDI chip (the one you have linked to) can do, is convert a microcontroller's serial port (like the one on the arduino) into a format that your PC can read over USB as a serial port. That's the ONLY function of that chip.

You are thinking that the chip makes the other end a fully fledged USB port, that can support anything that a USB port on a computer can do. It cannot do that.

What you are looking for is a chip/module that can connect a microcontroller serial port to a mass serial device. Here is one that can do that.

http://www.vinculum.com/prd_vdrive1.html

Note that connecting the microntroller serial port to the mass storage device is the ONLY thing that that particular module can do. You couldn't plug in a keyboard or mouse for example.

trialex,

Thanks man.

I see the error in my thinking, I was assuming the TFDI was a bonafide USB client type chip. But it's not and that's why I see the Arduino under the COM ports in device manager. Nice!

Your explainations are crystal clear. Something tells me that you are a professor.

Just one question, if I may. What chip could I use if I wanted to implement a full fledged USB device, HID class or the like? I was using a Flash Drive as an example and the link you provided is very useful for that type of USB device class.

I assume one of these will fit the bill: -AT90USB82: 8KB Flash -AT90USB162: 16KB Flash -ATmega32U4: 32KB -AT90USB646: 64KB Flash -AT90USB1286: 128KB Flash

Thanks again, Moe