1

I'm debugging a couple of RS232-to-TTL converter boards that I'm trying to use to program my Arduinos and one thing I would like to try would be to reduce the upload serial speed from 115200 to 19200.

How do I do that?

I imagine that there's a setting that can be easily changed on the Arduino IDE preferences. But where is it? But then the bootloader speed would have to match that? How do I change the serial upload speed on optiboot, too?

2

On Arduino IDE side, the upload speed is coded in hardware/arduino/boards.txt

uno.upload.speed=115200
...

for every kind of board; you cannot change it directly from the IDE (that would be too dangerous as that value must match the expected speed for the actual bootloader of every board).

Now as per the optiboot loader side, the upload speed is defined in BAUD_RATE macro, in optiboot.c:

/* set the UART baud rate defaults */
#ifndef BAUD_RATE
#if F_CPU >= 8000000L
#define BAUD_RATE   115200L // Highest rate Avrdude win32 will support
#elsif F_CPU >= 1000000L
#define BAUD_RATE   9600L   // 19200 also supported, but with significant error
#elsif F_CPU >= 128000L
#define BAUD_RATE   4800L   // Good for 128kHz internal RC
#else
#define BAUD_RATE 1200L     // Good even at 32768Hz
#endif
#endif

So I guess you can:

  1. #define BAUD_RATE 19200 before that block of code
  2. recompile the optiboot loader
  3. upload your own new bootloader version
  4. update uno.upload.speed accordingly in boards.txt
  5. check it on the usual blink sketch and cross your fingers :-)

Please note that this kind of task is not for beginners, you need to know what you're doing. Also note that I disclaim any responsibility if you get unable to upload programs to your Arduino afterwards!

  • 1
    This isn't going to "fry" your arduino. At worst, you'd wind up with a ATmega with a damaged boot loader, which would just mean you'd need to re-program it again via ICSP. – Connor Wolf Mar 30 '14 at 23:01
  • Then say you could render your arduino unrecoverable without a proper programmer. "Fry" implies actual hardware damage, not just mis-configuration that makes recovery involved. – Connor Wolf Mar 31 '14 at 5:57
  • no proprer progrqammer is needed, you can use ftdi/8u2 chip on-board with bit-bang mode. – Lesto Mar 31 '14 at 13:07
  • Tried it and it worked great! Well, the Uno didn't like the optiboot running on 56200 bps (not sure why), but the Severino and my custom boards with serial FTDI-like programming headers all worked. I also couldn't compile the optiboot slower than that (tried 19200) because other compile errors, but that's ok. I used Arduino IDE 1.0.5 and followed the instructions on .\hardware\arduino\bootloaders\optiboot\README.TXT and didn't have to install anything beyond the IDE. Nice!! – Ricardo Apr 1 '14 at 6:08
  • 1
    And that solved the problem with my RS232-to-TTL converter board. It worked ok with 56200 bps. Thanks much!! – Ricardo Apr 1 '14 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.