Go Down

Topic: Optiboot with FTDI Problems.. (Read 12755 times) previous topic - next topic


The FTDI holds DTR low during communication rather than sending a pulse, so you'll need a 0.1uF capacitor between DTR and Reset.  Otherwise the ATmega328 is being held in Reset whilst avrdude is trying to upload a new sketch.

If 144000 baud doesn't work, you can try recompiling Optiboot for 115200 baud at 20MHz.  Thanks (again) to Bill Westfield, this is rather easy.  Go to the hardware/arduino/bootloaders/ folder in the IDE, create a new directory, and into it download the files from https://github.com/WestfW/Arduino/tree/master/hardware/arduino/bootloaders/optiboot.  In the Makefile change the line atmega328: AVR_FREQ = 16000000L to atmega328: AVR_FREQ = 20000000L, and run the commands
Code: [Select]
..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino clean
..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino atmega328

Hopefully you'll then have a new file called optiboot_atmega328.hex.  Open this file and the Optiloader sketch in a text editor, and locate the image_t PROGMEM image_328p section in Optiloader.  Replace the hex data in Optiloader with the data from the new .hex file, taking care to conserve the formatting (actually you only need to replace the lines starting :107E20 and :107E30, as the rest is unchanged).  Once this is done, follow the previous recipe for uploading the bootloader.  Before trying to upload a sketch you'll also need to create a new section in the boards.txt file, with all the same settings as for the Uno except with f_cpu set to 20000000L.


Excellent news on recompiling optiboot! I will try this out when I get home later today... as for the FTDI.. I had the 0.1uF capacitor between DTR and Reset, and still had no luck.. I will double check, and try it again..

Thanks again, tim7


The breadboard Arduino resembles very much the minimalist Arduino-Pro boards made by Sparkfun Electronics.  To double check the connections required for programming via an FTDI cable, take a look at Sparkfun's schematics at http://www.sparkfun.com/products/9718 and http://www.sparkfun.com/products/9219.

As an aside, Sparkfun is extremely good about publishing schematics and firmware, and I like their Pro-series Arduino boards a lot.


Well, it was long day today so I'm just now getting around to working with recompiling Optiboot.. I'm a little confused on where the makefile is that I am suppose to edit.. what directory is it in? I found several makefiles, and I want to be sure I'm changing the right one.


Oct 04, 2011, 09:11 am Last Edit: Oct 04, 2011, 09:26 am by westfw Reason: 1
go to  hardware/arduino/bootloaders/ (inside the arduino installed directory) and create a NEW directory (say "optiboot20")
Then when you copy the files from https://github.com/WestfW/Arduino/tree/master/hardware/arduino/bootloaders/optiboot in to that directory, you'll be getting a new makefile, and that's the one to edit.)  (Actually, you can probably use the existing "pro_20mhz" target.)  It'll look like this, more or less:

C:\Documents and Settings\Bill Westfield>cd \bin\arduino-0022\hardware\arduino\bootloaders\

C:\bin\arduino-0022\hardware\arduino\bootloaders>mkdir optiboot20

C:\bin\arduino-0022\hardware\arduino\bootloaders>rem copy files using web browser

C:\bin\arduino-0022\hardware\arduino\bootloaders>cd optiboot20

Volume in drive C has no label.
Volume Serial Number is C818-E05C

Directory of C:\bin\arduino-0022\hardware\arduino\bootloaders\optiboot20

10/03/2011  11:57 PM    <DIR>          .
10/03/2011  11:57 PM    <DIR>          ..
10/03/2011  11:40 PM            34,011 boot.h
10/03/2011  11:39 PM            13,063 Makefile
10/03/2011  11:40 PM                60 omake.bat
10/03/2011  11:40 PM            22,344 optiboot.c
10/03/2011  11:41 PM             1,932 pin_defs.h
10/03/2011  11:54 PM             1,636 stk500.h
              6 File(s)         73,046 bytes
              2 Dir(s)  10,761,437,184 bytes free

C:\bin\arduino-0022\hardware\arduino\bootloaders\optiboot20>.\omake pro20

C:\bin\arduino-0022\hardware\arduino\bootloaders\optiboot20>..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino pro20
../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega168 -DF_CPU=20000000L  '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'   -c -o optiboot.o optiboot.c ../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega168 -DF_CPU=20000000L  '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib -o optiboot_pro_20mhz.elf optiboot.o ../../../tools/avr/bin/avr-size optiboot_pro_20mhz.elf
  text    data     bss     dec     hex filename
   500       0       0     500     1f4 optiboot_pro_20mhz.elf
../../../tools/avr/bin/avr-objcopy -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex optiboot_pro_20mhz.elf optiboot_pro_20mhz.hex
..\..\..\tools\avr\bin\avr-objdump -h -S optiboot_pro_20mhz.elf > optiboot_pro_2
/usr/bin/sh: ......toolsavrbinavr-objdump: command not found
make: *** [optiboot_pro_20mhz.lst] Error 127

rm optiboot.o optiboot_pro_20mhz.elf

C:\bin\arduino-0022\hardware\arduino\bootloaders\optiboot20>dir *.hex
Volume in drive C has no label.
Volume Serial Number is C818-E05C

Directory of C:\bin\arduino-0022\hardware\arduino\bootloaders\optiboot20

10/03/2011  11:57 PM             1,467 optiboot_pro_20mhz.hex
              1 File(s)          1,467 bytes
              0 Dir(s)  10,761,433,088 bytes free


the part in red looks like a bug.  In a spot that worked before; I'll have to look into that.  Grr.  It still produces a valid .hex file you can load into your AVR, though; the error is in generating the .lst file...


the part in red looks like a bug.  In a spot that worked before; I'll have to look into that.  Grr.

It looks likely that this is because I installed WINAVR, which results in there being a "sh.exe" in my path, which make then uses as a first choice over cmd.exe.  If you don't have a sh.exe in your path, it should work fine.

grr.  how am I supposed to make THAT work automatically?  (and if make will run either cmd.exe that needs backslashes, or sh.exe that can't have backslashes, why doesn't IT fix the filename?!  Grrrr.)


Just force everyone to use a wrapper batch/script file to start the make rather than start make directly
from the commandline.

Then in the wrapper force the PATH variable to include the path to the arduino supplied WinAVR/unix
tool directory by adding to the front of PATH.
Then set TMPDIR, then crank up make and you will never have to have worry about
all the screwy backward slash stuff anymore and can remove all that DOS specific
stuff inside the makefile.

The wrapper can be smart enough to look in a few places for the tools rather
than just assume that they are always in a specfic location relative to the current directory.
i.e. pre 0018 relative paths are different from now. and WinAVR might be installed. It is easy
to look around for them and then pick one based on a priority and you can also
us an environment variable to override this search for special uses.

This is what I do to allow building the glcd library on both windows and linux.

--- bill


Arduino IDE.. I don't have a lot of experience with avrdude..

I believe the Arduino IDE uses avrdude behind-the-scenes.

Go Up