serial data corruption at 115200 baud

I'm trying to stream a large amount of data to an Arduino Diecimila (USB), and I need at least 100,000 baud (i think this would be at least 11KB/sec).

Using Processing, if I transmit a block of around 256 bytes of data every 1 second at 115200 baud, I'm seeing a lot of byte drop-out when using the Serial (or direct to wiring_serial) library.

57600 seems to be the fastest rate that I can reliably stream data to the Arduino without corruption. This is strange, because the ATMega168 data sheet claims that the chip's serial interface can support much greater than that speed at 16Mhz.

I thought maybe the interrupt-driven routine is too slow and is somehow missing bytes. Maybe I need to write a more dedicated serial processing loop?

Has anyone else tried to send data quickly to the arduino, and if so, did you see this sort of corruption?

Thanks!!

try writign some code to send a block of data repetetively... does that work? then perhaps add in some of the other tasks you have in your code, to see which one is screwing up the data transmission. I send data perfectly at 115200 all the time.

D

I tried that. I removed all the code except for the part that calls Serial.available() and Serial.read() I am transmitting a variation of the data back to my laptop as well to confirm successful transmission.

Is it possible there's a bug with two-way transmissions causing corruption? I noticed that the serial code (uart.c) in Wiring-013 is somewhat different from the code in Arduino-009 and -010 (wiring_serial.c)

hi

is the problem with the Arduino receiving serial, or sending it?

D

I'm pretty sure it's with receiving the data because I have a counter that expects a 256-byte packet every second or so. I will see all the right data, but certain bytes will drop out. For example, if I send this data (showing 16 lines of 16 bytes):

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

I will instead see:

--------------

--------------

--------------

--------------

--------------

--------------

--------------

--------------

-------------

--------------## --------------## -------------##- -------------##- ------------####

(only 252 bytes received)

Notice that occasionally bytes will get dropped. At 57600 baud, I don't see this problem.

You may be reading it too slowly from the buffer and it overflows hence the lost bytes. Thats all I can think of.

I thought of that too, but when I modified the 128 byte receive buffer in wiring_serial.c to be 256 bytes, I had the same problem. I want to stream at nearly full 115200 baud rates, but for this test I'm only just sending a block of 256 bytes at 1-second intervals - not even full bandwidth consuming rates, yet I still see this error.

It's more like new bytes are coming in during the interrupt from the previous received byte or something.