Mega2560 R2 Board - Using the onboard USB to Serial 8U2 IC

Hello,

This is my first post here so please go easy on me :slight_smile:

I have an idea for a project using the Mega2560 board.

Basically I need a PC (or MAC, Linux etc) to be able to send large amounts of data through the Virtual COM port ( over USB ) to the main 2560 IC. The 2560 will program this data into a number of Flash ICs.

I have no code made at this time, I just want to see what can and cannot be done using the 8U2 IC with standard firmware inside.

I have some queries about the USB - COM firmware in the 8U2 IC.

  1. The Baud rate I select for the Virtual COM port at the PC - is this the exact same Baud rate that the 8U2 will use for the RXD1 & TXD1 pins?

Example: If I set the rate to 9600 on the PC and send some data through a terminal program - does this come out of the 8U2 at exactly 9600? The same for other baud rates (57600, 115200 etc) ?

  1. Hardware flow control. If would be great if I could use some sort of hardware flow control. I see on the schematic that the 8U2 has a pin called RTS (Pin 12). Does the firmware in the 8U2 monitor this pin when acting as a USB-Serial bridge and will it send this signal back to the PC COM port?

Many Thanks!

  1. Yes. Data between PC & USB is actually much faster, but it comes out at 9600, etc.

  2. Don't know. Check the schematic on the Products page for the Mega. If not connected, then likely not.
    RTS is generally an output from the USB/Serial chip, with CTS the matching input. CTS may be connected to ground, indicating the USB/Serial chip is always Clear to Send.

When you say send large amounts of data to program into Flash IC's how much data are you talking about and is this parallel programmed into several flash chips or spread across several flash chips?

Implementation detail.

Might be better off with atmega1284P with 16K SRAM to hold the incoming data before sending it to presumably slower offboard flash devices.

SPI based flash devices would be quick.

You should be able to transfer data at 1,000,000 baud.

A Leonardo which doesn't use the 8U2 is very much faster if you use Arduino 1.5.7

...R

Thanks for the replies :slight_smile:

The data size will be anything from 512KB to 2MB going into parallel 8-bit flash. The actual write speed is not really an issue, 3-5 mins for 2MB is acceptable for this application. I should be able to write a byte to the flash inbetween bytes coming in - I need to experiment with baud speeds.

I found this page for calculating reliable baud rates for 16Mhz..
http://www.wormfood.net/avrbaudcalc.php

I had the 2560 reading and looping back data to the 8U2 at 125000 baud rate with no errors. Time to get busy!