At 12:08 PM 19/03/2013, you wrote: >I am trying to transfer 256 bytes of at data 1M baud rate from my PC=20 >to an Atmega328 microcontroller. I am using checksum to verify the=20 >integrity of the data and I am emptying the received data into a=20 >ring buffer as quickly as possible. This is all I have in my=20 >interrupt subroutine: >temp =3D UDR0; >BufferWrite(&rx_buffer,&temp); >The data is transferred properly only at speeds upto 250K baud rate.=20 >It results in error beyond that point. The Atmega 328 datasheet=20 >specifies that it possible to transfer at speeds upto 2M baud rate.=20 >The ring buffer size is about 400 bytes and I am looking for some=20 >suggestions to achieve higher baud rates while maintaining the data integr= ity. >Sai How long does it take (worst case) to execute the interrupt routine, including context save, context restore and whatever that function called "BufferWrite" actually does? look at the emitted asm code and figure=20 out the cycles and microseconds.. more intrusively, trigger a pin on and off at the=20 beginning and end of the ISR.. look at it on an oscilloscope. The usual trick is to use a write pointer that wraps automatically=20 into a power- of-two-size buffer (eg. 256 or 512 bytes) and chase its tail with the=20 read pointer. 1M baud may be difficult over any length of cable anyhow, using conventiona= l RS-232 drivers. Have a look at the waveforms on an oscilloscope. It will be close, at best. --sp --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .