0
Offline
Jr. Member
Karma: 0
Posts: 85
Arduino rocks
|
 |
« on: March 25, 2012, 02:26:59 pm » |
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() { }
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 101
Posts: 9551
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #1 on: March 25, 2012, 03:42:28 pm » |
you have to use tuned speeds that fit nicely with the 16MHz clock. got succesfull transfers at 230400, 345600 and 500000 see older thread - http://arduino.cc/forum/index.php/topic,61381.msg444421.html#msg444421
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #2 on: March 25, 2012, 04:05:10 pm » |
I typically use 250K and have had no problems.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 85
Arduino rocks
|
 |
« Reply #3 on: March 25, 2012, 05:07:15 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 38
Posts: 6049
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #4 on: March 25, 2012, 05:35:49 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #5 on: March 25, 2012, 08:07:20 pm » |
Can I ask all that asked/replied what USB/TTL adapter you are using? Arduino Uno. Pololu USB AVR Programmer.
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 101
Posts: 9551
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #6 on: March 25, 2012, 11:52:31 pm » |
uno & 2009, std usb
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 85
Arduino rocks
|
 |
« Reply #7 on: March 26, 2012, 06:48:16 pm » |
arduino duemilanove std usb cable
|
|
|
|
|
Logged
|
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 33
Posts: 3015
I only know some basic electricity....
|
 |
« Reply #8 on: March 26, 2012, 07:49:37 pm » |
How does this compare to SPI?
One reason is that every mobo I have owned for over 10 years now has SPI.
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 38
Posts: 6049
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #9 on: March 26, 2012, 07:53:49 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #10 on: March 30, 2012, 12:10:29 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Pittsburgh, PA, USA
Offline
Faraday Member
Karma: 33
Posts: 3015
I only know some basic electricity....
|
 |
« Reply #11 on: March 30, 2012, 03:52:27 am » |
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!
|
|
|
|
|
Logged
|
Examples can be found at Learning in the Main Site and at the Playground
|
|
|
|
|