1
\$\begingroup\$

I make my own electronic boards often with an Atmel ATmega328P. I used AVR Studio for programming. Now I tried to make the same settings with avrdude and it looks, that they are not really compatibale.

  1. Is there a way to set the programming speed in avrdude? I want to program my fuses with 2.1592kHz and program my firmware with 500kHz. Does anyone know a command?

  2. It seems that AVR Studio decodes the values for the fuses different than avrdude. Especially the efuse is different. I think these two are the same:

AVR Studio: efuse:0xFD, hfuse:0xDA, lfuse:0xFF

avrdude: efuse:w:0x05:m ­hfuse:w:0xDA:m ­ lfuse:w:0xFF:m enter image description here

Thank you for your hints.

Felix

\$\endgroup\$
2
\$\begingroup\$

Is there a way to set the programming speed in avrdude? I want to program my fuses with 2.1592kHz and program my firmware with 500kHz. Does anyone know a command?

Use parameter -B <bitrate>: Specify the bit clock period for the JTAG interface or the ISP clock (JTAG ICE only). The value is a floating-point number in microseconds. The default value of the JTAG ICE results in about 1 microsecond bit clock period, suitable for target MCUs running at 4 MHz clock and above. Unlike certain parameters in the STK500, the JTAG ICE resets all its parameters to default values when the programming software signs off from the ICE, so for MCUs running at lower clock speeds, this parameter must be specified on the command-line. It can also be set in the configuration file by using the ’default_bitclock’ keyword.

It seems that AVR Studio decodes the values for the fuses different than avrdude. Especially the efuse is different.

Normally, the raw fuse byte values should be identical as those are just read out values and are not interpreted in any way. See the answer from microtherion for a possible explanation why the values are different in this case.

\$\endgroup\$
  • \$\begingroup\$ thank you! I figured out how the set the bitrate. It is the 1/f_sck in us. So if you want to program with 2kHz, set -B 500. If you want to program with 500kHz, set -B 2. \$\endgroup\$ – user1446021 Apr 10 '14 at 6:40
2
\$\begingroup\$

To answer your second question, for an ATmega328p, only the 3 LSBs of efuse matter, so the two values you show are identical, as far as the MCU is concerned. It's possible that avrdude and AVR Studio treat the "don't care" bits differently when reading the value back for verification.

\$\endgroup\$
  • \$\begingroup\$ Plausible theory. \$\endgroup\$ – Rev1.0 Apr 10 '14 at 8:11
1
\$\begingroup\$

Did you know that Atmel Studio also comes with a command line tool named atprogram? Actually works pretty nicely once you figure out where to put each value :-)

\$\endgroup\$
  • \$\begingroup\$ Shouldn't this be a comment? ;) \$\endgroup\$ – Rev1.0 Apr 10 '14 at 8:22

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.