Set Arduino serial baud rate above 115200 ->230400, 256000,307200,614400

Hello,

I would like to increase the speed of the serial port above 115200 baud. I have tried the test below. Usb cable from pc connected to arduino 328p. Tried to view results in br@y terminal 1.9b. It did not print anything(if I try same test with 115200, it works fine). Do I have to modify hardwareserial.cpp in order to achieve these higher speeds?

Thanks,

-ren

void setup()
{
Serial.begin(256000);

Serial.println("Hello world!");
}

void loop()
{

}

you have to use tuned speeds that fit nicely with the 16MHz clock.

got succesfull transfers at 230400, 345600 and 500000
see older thread - Fast communication to PC with low Arduino footprint - #12 by robtillaart - Networking, Protocols, and Devices - Arduino Forum

I typically use 250K and have had no problems.

robtillaart,

Yes, I see that now. I did get 230400 to work, had data bits set incorrectly to 7 in the terminal. If I keep the speeds listed on the mega 328 datasheet for 16mhz, it works well, as you stated. I tried pushing it to 2mbs using the code you posted(see below). I didn't do any error checking, but it seemed to work fine. By the way, if anybody is interested, the speeds listed in the datasheet for 16mhz are 230400/250000/500000/1000000. Also it doesn't have it listed, but indicates 0% error up to 2mbs using u2xn=1.

Thanks for the help!

-ren

void setup()
{

Serial.begin(2000000); // !! 115200, 230400, 345600, 460800 X
//delay(1000);
//Serial.println("Hello World");
}

void loop()
{

unsigned long t1 = millis();
for (long i=0; i< 10000; i++)
{
Serial.println("12345678"); // 10 bytes incl \r\n
}
Serial.println(millis() - t1);
}

I'm interested in this topic as well. Can I ask all that asked/replied what USB/TTL adapter you are using? I have FTDI and 8u2 with arduinos and a moderndevice.com usb bub II.

liudr:
Can I ask all that asked/replied what USB/TTL adapter you are using?

Arduino Uno. Pololu USB AVR Programmer.

uno & 2009, std usb

arduino duemilanove std usb cable

How does this compare to SPI?

One reason is that every mobo I have owned for over 10 years now has SPI.

renasis:
arduino duemilanove std usb cable

Thanks for the good news. I'll try this also. It's (500000) a lot better than 115200 with almost 8% error because of frequency mismatch.

GoForSmoke:
How does this compare to SPI?

SPI requires two lines (but usually uses three or four) instead of the one (but usually uses two) required for serial connections. Clocking is always performed by the master; neither the master nor the slave needs a calibrated clock. Serial requires both sides to have moderately calibrated clocks. The maximum bitrate of SPI is F_CPU / 2 (8 Mb/s). For asynchronous serial communications the maximum bitrate is F_CPU / 8 (2 Mb/s).

One reason is that every mobo I have owned for over 10 years now has SPI.

I wonder if that could be used for programming.

It seems that they are there to at least recover bricked bios'es.
I also see some articles on Linux SPI drivers but wow, not simple!