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?
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.
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.
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.