arduino mega and passing a file from usb to serial 1,2, or 3.

Hi All,

I have a project i am working on, where a computer application talks through an arduino mega via usb to some serial devices that may be connected to serial1,2, or 3.

Once the arduino recognizes the device type, and what serial port it is connected to, it checks the configuration bin file, and parameter text file. It also requests the firmware version of the device.

If i were updating one of these files without the arduino connected, I would be using a terminal program like zoc, or putty, sending the device a command that lets it know a new file is going to be sent, and then transfer the file using xmodem or xmodem1k.

currently, all the commands sent from the computer to the arduino are compared to a list of strings. If the command matches a string, the arduino takes some kind of action. if it doesn't it passes the command through serial1,2 or 3 to the device, and then listens for a response. The arduino then passes any response back to computer via usb.

Is there a way that i can pass a bin, or text file through the arduino to the connected device? I suppose i could take the arduino out of the loop for a period of time.... maybe by using relays to bridge serial and serial1,2, or 3 for 30 seconds or so, and using a timer to pause the loop. I could then send the file. I'd rather not go that route.....

any ideas?

tl/dr? how can i pass a bin or text file from a computer, through an arduino, and out the serial connections?

Everything can be sent over USB and SerialX, like e.g. the program code is loaded onto an Arduino.

Binary data (files) should be prepended by a byte count, so that the receiving program knows how many bytes to transfer. I cannot recommend a special PC program, I'd write my own program instead. Check your programs, whether they can use a special protocol for binary data transfer.