Trouble modifying Optiboot Watchdog Timer for Internet Bootloader

Hi there,

I’ve been working on a project to upload arduino sketches over serial from a cloud server, and because of propagation delays it seems like I need to lengthen the optiboot watchdog timer for more consistent performance.

I’ve tried changing the line in optiboot.c:

watchdogConfig(WATCHDOG_1S)

to

watchdogConfig(WATCHDOG_2S)

among other things, including WATCHDOG_OFF just to see if anything happened. No matter what I do, the watchdog timer never seems to change.

I am using an arduino uno r3 with Windows 7. I added a folder in …/Arduino/hardware/arduino/bootloaders/ for the modified optiboot and added entry to my boards.txt.

The build process I am using is:

  1. Modify optiboot.c
  2. run ‘omake atmega328’
  3. using arduino IDE, burn bootloader with the new board selected using arduino leonardo as ISP

I get no errors in the bootloader burn process, but the watchdog behavior never seems to change. I am checking this by pressing the reset button, and expect to see differences in how long it takes for the board led to come back on.

What am I missing here? Thanks in advance!

Watchdog timer can be set for 8s max. for ATmega328P, try this for better observation. This time should be between reset and application start if no data appears on serial input during bootloader run.

I added a folder in .../Arduino/hardware/arduino/bootloaders/ for the modified optiboot and added entry to my boards.txt.

Did you make sure to point the new boards.txt entry at the new bootloader directory? Make sure verbose logging is turned on for uploading, and make sure it's reading the correct .hex file. Look for a line like:

avrdude: reading input file "/Users/billw/Documents/Arduino/hardware/optiboot-extensions/bootloaders/optiboot/optiboot_atmega8.hex"

(In this example, you'll notice that it's finding the .hex file in a directory that is relative to where it found the particular boards.txt with the optiboot/mega8 "extension", rather than the master arduino install directories...)

Solved, thanks for the help everybody!

I'm not sure why this is (maybe someone can enlighten me) but I changed the bootloader filename from optiboot_atmega328.hex to optiboot_atmega328_new.hex and it magically started working. This seems strange because looking at the verbose avrdude output it seems that it was looking in the correct directory (different than the standard optiboot directory).... Does the IDE cache hex files or something?

Anyway, it was probably bad practice to have the new bootloader named optiboot.c anyway, so I changed its name and everything works fine.