Pages: [1] 2   Go Down
Author Topic: Arduino AVRDude -D option  (Read 3336 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

trying to program an ATtiny2313 with a metaboard-programmer (arduino clone) and the Arduino-IDE runnig avr-developers special core, I have a problem with the -D option in AVRDude, that is the default (disable chip erase). A naked chip is programmed with no problems, but the second try ends up in a verify-error. I had to do a chip erase "manually" (-e) and it worked.

Is there a method to overwrite the -D option from the Arduino-IDE? I dind´t find it in the AVRDudeconfig or Arduino-Preference.

Thanks for Help
Themroc
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have a problem with the -D option in AVRDude, that is the default (disable chip erase)

Disable chip erase is the default?  Doesn't seem to be for my version (5.10).  Which version are you using?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I meant the Arduino-IDE calling AVRDude default. I´m using 022. AVR-Dude is ok:)
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The command line when I upload an empty Sketch...

Code:
C:\arduino-0022\hardware/tools/avr/bin/avrdude -CC:\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cavrispv2 -P\\.\COM8 -Uflash:w:C:\Users\CODEB~1.001\AppData\Local\Temp\build1468340934531411719.tmp\sketch_mar22b.cpp.hex:i

Broken into separate lines...

Code:
C:\arduino-0022\hardware/tools/avr/bin/avrdude
-CC:\arduino-0022\hardware/tools/avr/etc/avrdude.conf
-v -v -v -v
-patmega328p
-cavrispv2
-P\\.\COM8
-Uflash:w:C:\Users\CODEB~1.001\AppData\Local\Temp\build1468340934531411719.tmp\sketch_mar22b.cpp.hex:i

There is no dash-D.  I suspect the problem is something else.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh sorry my version contains the -D option and I can´t get it away:)

D:\arduino-0022\hardware/tools/avr/bin/avrdude
 -CD:\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v
-pattiny2313
-cusbasp
-P\\.\COM12
-b19200
-D
-Uflash:w:C:\DOKUME~1\Me\LOKALE~1\Temp\build1303
597068202028020.tmp\BlinkWithoutDelay.cpp.hex:i

thanks themroc
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tested it with the same command ommitting the -D and it worked. But it´s boring to copy the command from the Arduino-IDE and deleting -D.

Any idea, how to set (or to find) the right preference file?

T
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have an "upload.using" entry in "boards.txt" for the ATtiny2313 section?  It should be something like this...

myboardname.upload.using=myprogrammer
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NO I didn´t, but the other boards don´t have this option. I only specified the upload.protocol=usbasp. The Problem is, that the upload works once. It is definitly the -D option. Iwrote a batchfile to erase the chip before.

Regards
T
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok Iwould like to know what this using does.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


When a section in "boards.txt" does not have an "upload.using" entry, the Arduino IDE performs a "bootloader upload".  For you, that means the dash-D option is added when AVRDUDE is run.

When you want to upload using an ICSP (in your case the "metaboard-programmer") you have to either add an entry to "programmers.txt" or select a close match.  As far as I can tell, this is what you should add "programmers.txt"...

Quote
metaboard.name=USBasp
metaboard.protocol=usbasp

You then need to update "boards.txt" so that uploading to your board is performed through the "metaboard" programmer.  Something like this should work...

Quote
attiny2313at8.name=ATtiny2313 @ 8 MHz
attiny2313at8.upload.using=metaboard
attiny2313at8.upload.maximum_size=2048
attiny2313at8.bootloader.low_fuses=0xE4
attiny2313at8.bootloader.high_fuses=0x9F
attiny2313at8.bootloader.extended_fuses=0xFF
attiny2313at8.bootloader.path=empty
attiny2313at8.bootloader.file=empty2313at8.hex
attiny2313at8.bootloader.unlock_bits=0x3F
attiny2313at8.bootloader.lock_bits=0x3F
attiny2313at8.build.mcu=attiny2313
attiny2313at8.build.f_cpu=8000000L
attiny2313at8.build.core=CoreSubdirectoryGoesHere
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for explanation. I ´will try this. Did you work with the special cores from AVR-developers? With the attiny2313  I got it working, but not with an Atmega48 or 8. Uploading the bootloader works with the Atmega8, sketches are uploaded correctly, but don´t work.

T
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Did you work with the special cores from AVR-developers?

No, I haven't.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot coding badly. With your "using" modification it worked fine. The terrible -D option disappeared. smiley

I used the following code:

programmers.txt
usbasp.name=USBasp
usbasp.communication=usb
usbasp.protocol=usbasp


boards.txt
...
atmega8.name=Arduino  ATmega8
atmega8.upload.using=usbasp
atmega8.upload.protocol=usbasp #maybe this is double?
...

The avr-developers files support many of the other avrs, so that you can programm it with the Arduino IDE. Although the blink-sketch uses nearly half the flash of a Tiny2313:(  Unfortunately Atmega48  doesn´t work. Maybe it is the fuses-section.

T
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For the ATtiny2313, give this core a try...
http://code.google.com/p/arduino-tiny/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh thanks. Does this core generate an optimized version for the tinys (to fit in the small flashes). The documentation in the boards.txt is really good (especially the fuse-settings). What about the "empty" bootloader specification? Is this only to set the right fuses, not to upload a bootloader?

T
Logged

Pages: [1] 2   Go Up
Jump to: