Instead of using a lookup table with (wrong) timings, this calculates the timings in SoftwareSerial::begin. This is probably a bit slower, but since it typically happens once, this shouldn't be a problem. Additionally, since the lookup tables can be removed, this is also a lot smaller, as well as supporting arbitrary CPU speeds and baudrates, instead of the limited set that was defined before. Furthermore, this switches to use the _delay_loop_2 function from avr-libc instead of a handcoded delay function. The avr-libc function only takes two instructions, as opposed to four instructions for the old one. The compiler also inlines the avr-libc function, which makes the timings more reliable. The calculated timings directly rely on the instructions generated by the compiler, since a significant amount of time is spent processing (compared to the delays, especially at higher speeds). This means that if the code is changed, or a different compiler is used, the calculations might need changing (though a few cycles more or less shouldn't cause immediate breakage). The timings in the code have been calculated from the assembly generated by gcc 4.8.2 and gcc 4.3.2. The RX baudrates supported by SoftwareSerial are still not unlimited. At 16Mhz, using gcc 4.8.2, everything up to 115200 works. At 8Mhz, it works up to 57600. Using gcc 4.3.2, it also works up to 57600 at 16Mhz and up to 38400 at 8Mhz. Note that at these highest speeds, communication works, but is still quite sensitive to other interrupts (like the millis() interrupts) when bytes are sent back-to-back, so there still are corrupted bytes in RX. TX works up to 115200 for all combinations of compiler and clock rates. This fixes #2019
Arduino
-
Arduino is an open-source physical computing platform based on a simple i/o board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing, MaxMSP). The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free.
-
For more information, see the website at: http://www.arduino.cc/ or the forums at: http://arduino.cc/forum/
-
To report a bug in the software or to request a simple enhancement go to: http://github.com/arduino/Arduino/issues
-
More complex requests and technical discussion should go on the Arduino Developers mailing list: https://groups.google.com/a/arduino.cc/forum/#!forum/developers
-
If you're interested in modifying or extending the Arduino software, we strongly suggest discussing your ideas on the Developers mailing list before starting to work on them. That way you can coordinate with the Arduino Team and others, giving your work a higher chance of being integrated into the official release https://groups.google.com/a/arduino.cc/forum/#!forum/developers
Installation
Detailed instructions are in reference/Guide_Windows.html and reference/Guide_MacOSX.html. For Linux, see the Arduino playground: http://www.arduino.cc/playground/Learning/Linux
Credits
Arduino is an open source project, supported by many.
The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, Daniela Antonietti, and David A. Mellis.
Arduino uses the GNU avr-gcc toolchain, avrdude, avr-libc, and code from Processing and Wiring.
Icon and about image designed by ToDo