I'm done with building my first bigger project using an Arduino Micro.
Now I want to program the atTiny84A, which seems to be perfect for the project.
I red all examples about how to use an Arduino Uno as an ISP, but I'm not sure if these guides work with my 84A.
So here is what I made:
I flashed the ISP sketch to my arduino (right COM-Port, board set to Arduino Micro, Programmer set to avr isp witch is default).
According to the comments in the ISP sketch I added some LED's (heartbeat, error, programming). After flashing, the heartbeat LED pulses -> Very nice, it worked!
I red the data sheet (http://www.atmel.com/Images/8183S.pdf) of the 84A to find the right pins, and so I connected arduino-pin 10 to RESET-pin of the 84A, 11 to MOSI, 12 to MISO and 13 to SCK.
GND and VCC is also clear!
Now I opened the blink sketch (changed pin from 13 to 0), switched the programmer to Arduino as ISP and selected atTiny84 @ 20 MHz as board.
After uploading, the log (update.verbose=true) shows me the following:
C:\Arduino\arduino-1.0.4\hardware/tools/avr/bin/avrdude -CC:\Arduino\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -pattiny84 -cstk500v1 -P\\.\COM13 -b19200 -Uflash:w:C:\Users\Flips\AppData\Local\Temp\build746589376383792063.tmp\Blink.cpp.hex:i
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Arduino\arduino-1.0.4\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM13
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
[\code]
Btw, neither the error nor the programming LED turned on...
I know that this error tells me that there seems to be no connection at all, connection between arduino and the 84A. But why?
Does anyone know how to connect the pins correctly?
Thanks,
Flips
I googled it and all I found out were wrong fuse bits. I made the misstake, that on my first try I flashed the tiny with board = atTiny84 @ 20 MHz EXTERNAL (I do not have any oscillators here). Is this the problem? Has this set the fuse bit to external clock (which isn't there) and because of this a second flash won't work until there is an external clock?
Sorry for double posting, but I think I'll quit that...
I'll order a few new 84A and this time I am going to set the right board (8Mhz INTERNAL!!!!).
I tried everything, I added an external oscialltor with those two 22pf capacitors as near as possible to the XTAL1/2, tried a second 5V Vcc source and finally tried this HV tutorial:
Thanks for your reply!
Does that solve my problem? Because at the moment my main problem is that my tiny is kind of "dead", isn't it? (
I'm a little bit confused at all, because of the log message: "avrdude: AVR device initialized and ready to accept instructions"...)
Do you mean I should use this core for my next tries with a "fresh" tiny?
It is probably locked out, but the HV programmer should be able to unlock it and return it back to Factory 1 MHz. Only 4 data lines, 5VDC, 12VDC and GND. Just put the 1Ks between the ATtiny and your Micro.
After uploading the posted ISP sketch and connecting SCK, MISO, MOSI, RESET, GND, VCC and XTAL1 (with Pin 9), I tried to upload the blink sketch to the tiny.
First try -> Same result (Invalid device signature).
Second try:
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv:
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
And that's always, only the second try gives me the "new" error. Searching for this error brings no "new" things.
I also checked every wire again.
I red that this seems not to be a problem of the tiny itself, but a problem of Arduino as ISP...
It is very likely a different pin from the Arduino Micro. Which means the sketch will have to be changed and your wiring will have to be changed. If I have time, I'll try to get it working tonight.
In the meantime, an LED (plus series resistor) connected to pin 9 then to GND should be dimly lit. If not then it is definitely the wrong pin.
And that's always, only the second try gives me the "new" error.
The ArduinoISP sketch gets a bit flaky when a problem occurs. Try resetting the programmer (your Arduino Micro) between attempts.
It is very likely a different pin from the Arduino Micro. [...]
According to the sketch pin 9 seems to be the right pin:
pinMode(9, OUTPUT);
// setup high freq PWM on pin 9 (timer 1)
An LED on pin 9 works, so there must be an output. I don't think that this is the problem because by connecting this pin to XTAL1 the error changed.
And resetting the arduino does nothing, I did it now 3 or 4 times: After every reset of the arduino, the first flash gives me the first error (Invalid device sig.) and a following second (or thirth or ...) flash gives me the second error...isn't that very strange at all?
No, I just wanted to flash a tiny using my arduino micro as ISP. But unfortunately I checked atTiny 84 @ 20 MHz External during the very first try.
So I thought my problem is that this first flash was successfull which implicates that the flashed tiny needs an external clock (doesn't it?). But now that seems not to be the problem because even with the ISP sketch that creates the necessary clock, I'm not able to flash a sketch to the tiny.
Edit: To answer your question, I didn't want to set any fuse, but I think I did it implicitly by flashing the tiny with the 20 MHz setting.
Flips:
Edit: To answer your question, I didn't want to set any fuse, but I think I did it implicitly by flashing the tiny with the 20 MHz setting.
No. The fuses are never set implicitly. They are set when you do it explicitly using avrdude from the command-line or when you execute Tools / Burn Bootloader from the Arduino IDE.
Ok that's nice to know.
No, I've done many tutorials and guides to "reset" the tiny. Yes, there have been instructions to burn the bootloader to the tiny via the arduino IDE...
But I can surely say that there wasn't any operation which was successful! Neither flashing a sketch to the tiny nor burning the bootloader has ever been successful.
For me, that's a little bit confusing because I'm not even able to read the fuse bits (avrdude says extended = high = low = 0xFF...).
Flips:
I red the data sheet (http://www.atmel.com/Images/8183S.pdf) of the 84A to find the right pins, and so I connected arduino-pin 10 to RESET-pin of the 84A, 11 to MOSI, 12 to MISO and 13 to SCK.
If yes then you have to use the ICSP header (or modify the ArduinoISP sketch to use bit-bang SPI). From that same webpage...
SPI: on the ICSP header. These pins support SPI communication using the SPI library. Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Arduino Uno, they are only available on the ICSP connector and on the nearby pins labelled MISO, MOSI and SCK.
spcomputing:
Micro pin 8 (SS) to ATtiny Reset Pin
Micro pin 9 (SCK) to ATtiny SCK
Micro pin 10 (MOSI) to ATtiny MOSI
Micro pin 11 (MISO) to ATtiny MISO
I think those are physical pins. I think the diagram in the upper-left corner is the one of interest... MOSI is top-left; SS is next to MOSI; SCK is top-right; MISO is next to SCK.
I suspect the ArduinoISP sketch will have to be modified for the SS pin.
Nice catch Coding Badly, I keep thinking of the mini when I see micro.
I think those are physical pins. I think the diagram in the upper-left corner is the one of interest... MOSI is top-left; SS is next to MOSI; SCK is top-right; MISO is next to SCK.
I suspect the ArduinoISP sketch will have to be modified for the SS pin.
I checked, and the pins on the board and chip coincidentally correspond (Yeah, that does not happen often enough).
The SS/Reset trigger (D10 on the Uno) was a concern for me as well, but I can not find "D10" in the sketch. It appears to be a SPI hardware call (SS or chip select) and must be in the avr library. Gammon's programmer would need adjusting from D10 to D8, like the Mega2560. I will check it out with my Leonardo this weekend.
Edit ---
My bad, SPI is PB0-3. I put my brain back in and realize your correct on the pin-outs. Check the pins_arduino
Ok the icsp header are the pins near to the reset button.
Is the conclusion now that on other arduinos, those pins (which were described in the isp sketch comments) are icsp-able but on my micro, I have to use the icsp header?
Edit:
[...] they are only available on the ICSP connector and on the nearby pins labelled MISO, MOSI and SCK
...ok icsp header or those pins.
(In Germany you say: Reading - Thinking - Posting... )
I'll try that this evening...