0
\$\begingroup\$

I accidently changed my ATtiny45 clock source to 128khz . After that I can't program it . I tried avrdude in terminal mode but it doesn't work .

>>avrdude -P COM4 -c avrisp -b 19200 -p t45 -t -F -u

terminal

(I'm using Arduino as ISP for programming)

How can I fix it ?

\$\endgroup\$
1
\$\begingroup\$

The ISP frequency can be up to 1/4 of the core clock so you must set you programmer to work at lower frequency. For 128KHz core clock the ISP can be up to 32KHz.

Use the -B flag of avrdude, try -B250 ( 4kHz)

-B bitclock

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.


If Arduiono ISP doesn't support that flag and you don't have any other programmer available you can use this ArduinoISP firmware that supports low speed chip erase and fuse burning.

\$\endgroup\$
  • 1
    \$\begingroup\$ Or ScratchMonkey, which will try high speeds first and then back off to slower speeds if necessary. \$\endgroup\$ – microtherion Mar 2 '14 at 18:48
  • \$\begingroup\$ Ty , Unfortunately I didn't disable CKDIV8 fuse , so my MC clock is 16000 . if i divide it by 4 => 4000 => 25 * 10e-5ms => 0.25us . I tried this but nothing happened . > avrdude -P COM4 -c avrisp -b 19200 -p t45 -B 0.25 \$\endgroup\$ – Shervin Gharib Mar 2 '14 at 20:35
  • \$\begingroup\$ @sistyN I haven't used ArduinoISP but from what I read -B doesn't work with it. You can try the modified ArduinoISP from the link I have provided or ScratchMonkey from the link that microtherion has provided. \$\endgroup\$ – alexan_e Mar 2 '14 at 21:21

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.