Tuesday, March 3, 2015

Using optiboot for Arduino pro mini 3.3v to enable watchdog with Arduino IDE 1.6

My Arduino Mega and Arduino Pro Mini does not reset properly after watchdog. In case of Arduino Mega, the watchdog works properly after writing down bootloader using another Arduino, but Pro Mini does not reset properly even after writing bootloaer. After some Googling I found that optiboot is a default for Arduino IDE 1.6.0 for Mega, and Pro Mini has traditional bootloader image. In short, watchdog reset works fine with optiboot image. The following is a stitch of various material that I googled to burn the optiboot to Pro Mini 3.3v 8MHz.

1. building optiboot contained in Arduino IDE 1.6
Arduino IDE 1.6 does not have make utility. So I had to use external make utility from cygwin.

2. Modifying the Makefile
Open C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot\Makefile and modify the following line. I got the information that FTDI USB serial chipset cannot handle 115200bps download and reset speed properly.

atmega328_pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=57600'

3. Build the bootloader for Pro Mini 3.3v
In the cygwin, run the following command

$ make atmega328_pro8

4. Adding entry to boards list.

Edit the following file to look like this. :
C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt

## Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 - Optiboot 57.6k
## --------------------------------------------------
pro.menu.cpu.8MHzatmega328ob=ATmega328 (3.3V, 8 MHz, Optiboot 57.6k)
pro.menu.cpu.8MHzatmega328ob.upload.maximum_size=32256
pro.menu.cpu.8MHzatmega328ob.upload.maximum_data_size=2048
pro.menu.cpu.8MHzatmega328ob.upload.speed=57600
pro.menu.cpu.8MHzatmega328ob.bootloader.low_fuses=0xFF
pro.menu.cpu.8MHzatmega328ob.bootloader.high_fuses=0xDE
pro.menu.cpu.8MHzatmega328ob.bootloader.extended_fuses=0x05
pro.menu.cpu.8MHzatmega328ob.bootloader.file=optiboot/optiboot_atmega328_pro_8MHz.hex
pro.menu.cpu.8MHzatmega328ob.build.mcu=atmega328p
pro.menu.cpu.8MHzatmega328ob.build.f_cpu=8000000L

## Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
## -------------------------------------------------

5. Restart Arduino IDE


References :
http://yveaux.blogspot.tw/2014/07/changing-arduino-bootloader-to-optiboot.html
https://code.google.com/p/optiboot/issues/detail?id=28

2 comments:

  1. Why don't you make bootloader upgrade WinApp for Pro Mini and Nano?

    ReplyDelete
  2. Thanks for this post! Very helpful. Would you mind sending me the binary? I'm having trouble running the makefile. After installing cygwin I try 'make atmega328_pro8' but it says 'no rule to make target 'atmega328_pro8'. stop.' do you need to copy the optiboot folder into cygwin somewhere?

    Thanks!

    ReplyDelete