1
\$\begingroup\$

I'm having a hell of time getting AVR ISP header on my circuit board to actually allow me to flash the chip. Basically, with an ATTINY85 you pretty much have to share programming pins with pins used by your program. I think something about this sharing is causing issues.

In the below schematic, J3 and J4 go to a board with 7 addressable APA102 RGB LEDs. J3 provides clock and data SPI signals, and J4 provides power and ground.

I have LED clock on the pin PB2 or SCK of the ISP headers, and the LED data pin on PB4 which is not shared with the ISP headers at all. PB3 controls a high power switch on the LEDs to prevent them from drawing current in sleep mode.

When I tried to flash a program with this setup, it seemed to work at first, though I could see red pulses on the LEDs, which surprised me. But the last step of the upload, the verification step checks the program was written correctly, failed. And now the chip can no longer be programmed since avrdude just gives avrdude: initialization failed, rc=-1

I managed to remove the chip form the board and put it in a socket by itself in a breadboard. In that state, I was able to flash it no problem, and it worked great when I soldered it back on to the board. But when I tried to flash it again on that board, the exact same thing happened. Clearly something in my circuit is to blame. But I'm not sure what.

What is preventing my circuit from allowing it to flash the ATTINY85? And, if necessary, what can I do to insulate the components from programming signals that they shouldn't need to be aware of?

Chakra Pendant by Squeegy 46acb26f5f80a881 - Upverter http://upverter.com/Squeegy/46acb26f5f80a881/Chakra-Pendant/embed_img/14256226900000/

^ click that and you can browse both the schematic and the PCB because Upverter is neat.

\$\endgroup\$
  • \$\begingroup\$ VCC on the ISP header may need to be connected. For example, the Atmel JTAGICE3 relies on the VCC pin to drive the target with the proper voltage level. So other ISP or ICE tool may require the same. \$\endgroup\$ – rioraxe Mar 21 '15 at 0:30
2
\$\begingroup\$

I don't see a pull up on the reset line. Is the micro configured by default with an internal pull up active? If not, you may be able to program because the ISP puts the micro in reset anyway, but the last step might fail because it needs to come out of reset momentarily.

Just something to check.

\$\endgroup\$
  • \$\begingroup\$ That's the first I've heard that might be required. Like I said, I can program the chip in a breadboard socket with no resistor on the reset pin. But I suppose a 10K resistor between the RESET and VBAT couldn't hurt? The more I think about this, the more switching to a ATTINY84 with 14 pins, instead of 8, seems like a good move. That way I have enough pins to not have to share running operations and programming roles. \$\endgroup\$ – Alex Wayne Mar 20 '15 at 17:02
  • 1
    \$\begingroup\$ Yeah, I recommend trying a 10k pull up first. You are most likely stuck in reset. Let me know if it works! \$\endgroup\$ – mblem22 Mar 20 '15 at 17:08

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.