Hi there. I was just wondering : what maximum speed can you use safely with the Serial.begin() syntax ? In the reference, it says that 115200 is the "popular" maximum, but i'm working on something that might need a lot more speed. I just ran a test sketch with 3 times that (345600 bps) and it seems to work ok, but what can I expect to lose with such high speed ? Couldn't find any info about that on any datasheet. Why so much speed : http://play-collective.net/blog/archives/26 Cheers
If you want high speed, you're going to need to use either 250 kbps, 500 kbps, or 1 Mbps. You won't be able to use 115.2 kbps for sustained data transfer because the baud error is too large on a 16 MHz controller, meaning that at 115.2k you will quickly lose synchronization with your target if you don't put in periodic transmit delays to allow for resynchronization. If you want to run at 1 Mbps, you will need to set the U2X0 bit of the UCSR0A register (I'm not sure if the Arduino serial functions have built-in support for running in double-speed mode). The only thing you definitely lose by running at a higher speed is time to prepare bytes for transmission. You are really going to have to optimze your code.
The USART section of the mega168 datasheet has all the information you need on this.
Thanks bens, I'll check the datasheet toroughly and will order some more ATMega168 chips ^^