4
\$\begingroup\$

I'm using an FTDI-based bit-bang programmer for my AVR MCUs with AVRDUDE. It works perfectly with ATmega32A, but does not work with ATtiny45.

The command that I use to try if it works is:

avrdude.exe -c pinb -P ft0 -B 4800 -U lfuse:r:-:h -F

The -c pinb stands for the following config:

miso  = 6;  # DCD
sck   = 5;  # DSR
mosi  = 3;  # CTS
reset = 7;  # RI 

For ATmega32A (-p m32) I get:

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e9502
avrdude.exe: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude.exe: writing output file "<stdout>"
0xe4

For ATtiny45 (-p t45) I get:

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude.exe: ft245r_program_enable: failed
avrdude.exe: initialization failed, rc=-1
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0xffffff
avrdude.exe: Yikes!  Invalid device signature.
avrdude.exe: Expected signature for ATtiny45 is 1E 92 06
avrdude.exe: safemode: lfuse reads as FF
avrdude.exe: safemode: hfuse reads as FF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude.exe: writing output file "<stdout>"
0xff

avrdude.exe: safemode: lfuse reads as FF
avrdude.exe: safemode: hfuse reads as FF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.

Note that everything is read as 0xFF.

I've already check the wiring multiple times. The MCU is in its stock state, without any firmware or fuse changes. Why doesn't it work?


Edit 1: specifying bitclock/baudrate. As suggested in the comments, I've tried to reduce the communication speed. Unfortunately, the windows version of AVRDUDE 5.3.1 didn't correctly recognize the -B and -b options. So I've compiled the latest AVRDUDE 5.11.1 with ft245r.patch from bug #30559: Ft232 bit-bang support on Ubuntu. Now I'm able to get for example baudrate = 200, but still no success.

Edit 2: voltmetering the wires. As I run AVRDUDE on low speed, I monitor the 4 outputs (MOSI, MISO, SCK, RESET) with a voltmeter. All of them change, except for the MISO wire - it seems to stay on the high level. Probably I have two broken chips?

\$\endgroup\$
4
  • \$\begingroup\$ Is this on the same board? Do you just pop the new MCU and replace the old one? The chip could be bad, have you tried another one? \$\endgroup\$ Jan 12 '13 at 18:14
  • \$\begingroup\$ I've tried another ATtiny45 chip, no success. What I do is just switch the 4 wires (+power) between chips on a breadboard. \$\endgroup\$
    – Goodrone
    Jan 12 '13 at 18:33
  • \$\begingroup\$ might be speed. attiny usually comes preconfigured to 1MHz internal oscillator. try solwing down the programmer clock speed. \$\endgroup\$
    – miceuz
    Jan 12 '13 at 20:16
  • \$\begingroup\$ Switched MOSI and MISO by accident? \$\endgroup\$
    – jippie
    Jan 13 '13 at 10:20
3
\$\begingroup\$

Please try with -B20 or -B50 -B100 flags if your programmer supports. Best way to flash an ATtiny is, USBTiny build from another ATTinyX5 :)

If you run your ATTiny on some low speeds (I run mine @ 8khz for example, yeah it's possible to clock it), you need to slower SCK pulses at programmer.

Edit: I want to add this, avrdude doesn't allow USBTiny with higher flag than -B250. But Since I am experimenting with ATTiny clock (32khz, 8 khz...), I need -B400 even -B2000... So just recompiled avrdude from source and increasing limit to 9000 and have no issues. Hack works good. Also you don't need wait to flash whole program. For rescuing low hz fused attiny, compile any program with 1/8mhz flags and CPU settings. Than just flash for a second and abort. This will restore fuse settings and you can reprogram whatever you want with high speed, for example -B1 flag. (I use this setting as default since it's fastest and working with 8Mhz 16Mhz PLL clocked ATtiny85. But -B1 will not program your 1Mhz fused chips.)

Regards, Erdem

\$\endgroup\$

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.