# High-speed computer interface with an Arduino

I'm planning a project with an Arduino that involves handling a lot of requests from a host computer, and the standard 115200 maximum baud over serial isn't sufficient. I'd like to be able to get 1Mbps full duplex if possible, but 400Kbps+ full duplex would be acceptable. I'm using an Arduino Due, so it should be able to handle significantly higher communications speeds.

Is there a way to significantly increase the baud rate over serial, or is there a second option I can go for in terms of interfacing with a computer at higher speeds?

• FTDI FT232 devices can go up to 3 Mbps without issue, so if you have a FTDI-based USB-serial converter, that would be an easy option. I really wish the Arduino people had stuck with them, rather then the ATmega16U2. – Connor Wolf May 1 '13 at 6:32
• Maybe the UART will support 1Mbps bitrates, but you also need the microcontroller the feed it with data. It can be done, but you'll reach a maximum quite easily. – jippie May 1 '13 at 6:54
• If you're slamming an AVR with "lots of requests" at 400 kbps, I'd be amazed if it has much time spare to do anything of use. – Nick T Jun 7 '13 at 23:27

It's definitely possible to get up in the Mbps range with an Arduino, especially with your Due. The serial monitor only supports bauds up to 115200, but you can use a separate terminal window which allows you to set your baud to anything you like.

In terms of setup, on the Arduino it's as easy as Serial.begin(1000000); or to that extent. It's all about the setup of the device that you want to communicate with, and what it can handle.

• Does the standard serial over USB driver support such speeds? I'm gonna be talking to it via a script, not the serial monitor in the IDE. – Polynomial Apr 30 '13 at 22:28
• I believe it does. If you are using a script, you should be in good shape. The UART hardware on the Arduino Due is the same as the UNO; it uses the ATmega16U to interface with serial, which is capable of at least 1Mbps. The serial over USB driver should support that rate as well. – Jay Greco Apr 30 '13 at 22:35
• To test, you could always set up a quick test sketch. Set the baud to something higher than default, and use a terminal set up at the same baud. If the data comes through, you know that the Arduino is good up to that baud. – Jay Greco Apr 30 '13 at 22:41
• Technically, it doesn't really matter what the host PC asks for in terms of baud rate, but rather only that the 16U and main Arduino processor agree - the actual USB side runs much faster than the serial baud rate anyway, and all the PC does is tell the 16U what speed to run its serial interface at. Also, if looking at inaccuracies in the baud divisors, remember that what really matters is that they match between the two chips on your board, not that they match some traditional goal. Fully leveraging that to the maximum might require custom firmware for the 16U. – Chris Stratton May 1 '13 at 1:39

I'd look into writing custom firmware for the Atmega16u2 that's doing the USB interfacing. That chip can speak full-speed USB (up to 12 Mbit signal speed) and the SPI output port of that chip is conveniently available available on the ICSP header. Hook that to the SPI input of the Arduino (also available on its ICSP header) and you can run SPI at, I think, 4 Mbit/s (4 CPU clocks per bit.)

The Atmegas on the mega (16u2 and 128) can run their serial port at up to 2 Mbit/s. If you write custom firmware for the 16u2, you can also use the asynchronous serial USART that's already there.

In both of these cases, you'll likely lose serial port programmability, so you'll have to use a USB-based separate programmer.

The LUFA project has lots of sample programs and helpful libraries for actually speaking USB on an Atmega chip. "libusb" is a convenient library to talk directly to USB devices, rather than having to rely on serial emulation.

There are some results that may be of use here.