Mega2560 as ICSP to Attiny2313 with avrdude -- did I do it right?! also, fuses.

Hey everyone,

I've been fighting all day with this crap because it kept giving me a dreaded "stk500_getsync() not in sync resp=0x00" error with avrdude.

However, I dig around more online, and found a post regarding the baud rate, so I changed this:

avrdude -p attiny2313 -c avrisp -P COM7 -U flash:w:main.hex -vvvv

to simply this:

avrdude -p attiny2313 -c avrisp -P COM7 -U flash:w:main.hex -b 19200 -vvvv

and amazingly, a whole bunch of stuff started scrolling and apparently it wrote the .hex file and verified it too.

This is the bottom of the command, after it was all scrolled and done.

I didn't get any errors, so I'm assuming I did it right.

Now, the code that I'm going to be using requires that I run the Attiny2313 at 12MHz with an external oscillator (see project here).

Do I need to burn any fuses for this?! It seems as though it's checked for the correct fuses at the end of writing and verifying the .hex file, as seen in the image above.

I've put the whole thing, start to finish, in this pastebin

Thanks for any help guys!

ominously: Hey everyone,

I've been fighting all day with this crap because it kept giving me a dreaded "stk500_getsync() not in sync resp=0x00" error with avrdude.

However, I dig around more online, and found a post regarding the baud rate, so I changed this:

avrdude -p attiny2313 -c avrisp -P COM7 -U flash:w:main.hex -vvvv

to simply this:

avrdude -p attiny2313 -c avrisp -P COM7 -U flash:w:main.hex -b 19200 -vvvv

and amazingly, a whole bunch of stuff started scrolling and apparently it wrote the .hex file and verified it too.

This is the bottom of the command, after it was all scrolled and done.

I didn't get any errors, so I'm assuming I did it right.

Now, the code that I'm going to be using requires that I run the Attiny2313 at 12MHz with an external oscillator (see project here).

Do I need to burn any fuses for this?! It seems as though it's checked for the correct fuses at the end of writing and verifying the .hex file, as seen in the image above.

I've put the whole thing, start to finish, in this pastebin

Thanks for any help guys!

The fuses that you're seeing are the default ones. Just because it read and verified the fuses doesn't mean that they are right for your application. If you want to run your attiny2313 with a 12MHz oscillator then you have to change your low fuse to FF. But just for the sake of it here is the fuse settings I use with a little modification (i normally use the internal oscillator but I changed that for you to an external). =)

Low fuse: FF
High fuse: 9F
Extended fuse: FF

To write these fuses with avrdude then try the following line:

avrdude -p attiny2313 -c avrisp -P COM7 -b 19200 -v -v -v -v -U lfuse:w:0xff:m -U hfuse:w:0x9f:m -U efuse:w:0xff:m

Hope that helped =)

Alrighty... I'm going to assume that I've done it correctly, and the chip has the code written to it. According to your post, I burned the fuses correctly. I got a successful output when ran the command you recommended. Also, it seems I can no longer talk to it. It gives me the error of a device ID being 0x0000000, when it used to show 0x01e9????.

Is it safe to say that the reason it's not working is because the chip is expecting an external crystal?

Here's a picture of my hackjob wiring...

ominously:
Alrighty… I’m going to assume that I’ve done it correctly, and the chip has the code written to it. According to your post, I burned the fuses correctly. I got a successful output when ran the command you recommended. Also, it seems I can no longer talk to it. It gives me the error of a device ID being 0x0000000, when it used to show 0x01e9???.

Is it safe to say that the reason it’s not working is because the chip is expecting an external crystal?

Here’s a picture of my hackjob wiring…

I’m not even going to try to follow the wires. If you want help with that then I suggest that you try using wires with a little more color variations. Eveything is green!!!

Anyway what I can see is that you’re missing a crystal and with the current configurations the chip won’t function without a crystal. So the answer is yes, try hoking it up with any crystal “above 8MHz” and see if you get the right device ID from avrdude. If not, then see if the chip is getting any power. If it still for some odd reason doesn’t work then then try drawing a schematic of your setup in “ex. fritzing” or similar and i’ll do my best to help you.

Well, you’re right. Can’t see much of anything with the wiring, but it’s like this:

5v - 5v
GND - GND
RST - RST
SCK - SCK
MISO - MOSI
MOSI - MISO

I learned to not match up MISO~MISO and MOSI~MOSI by fooling with that Maxim RS232 chip to revive a dead router. I have yet to try out using an external crystal because I don’t have any capacitors in the pF range to stabilize it… but I’ll get some and try it out soon enough :slight_smile:

EDIT: I’ve tried it by just shoving an 8mhz crystal in the breadboard, without capacitors, and it sprang to life!

Thanks bro, it’s much appreciated :smiley:

ominously:
Well, you’re right. Can’t see much of anything with the wiring, but it’s like this:

5v - 5v
GND - GND
RST - RST
SCK - SCK
MISO - MOSI
MOSI - MISO

I learned to not match up MISO~MISO and MOSI~MOSI by fooling with that Maxim RS232 chip to revive a dead router. I have yet to try out using an external crystal because I don’t have any capacitors in the pF range to stabilize it… but I’ll get some and try it out soon enough :slight_smile:

EDIT: I’ve tried it by just shoving an 8mhz crystal in the breadboard, without capacitors, and it sprang to life!

Thanks bro, it’s much appreciated :smiley:

Well you should hook it as following: MISO ~ MISO and MOSI~MOSI… I really don’t know how you got it working all the way around!

If you want your chip to be stable and be more accurate then use capacitors with capacitance somewhere between 18-22pF. I really don’t recommend using the chip without them.
Also when operating the chip use a crystal with a higher frequency than 8MHz. In this case you used a 8MHz crystal to see if the chip is still “alive” but the fuses is set for frequencies higher than 8MHz.

Your welcome! Glad I could help =)!

Well, since I dont have the parts to complete the first project, I went ahead and tried my hand at a RGB fader. I also have some ATTiny13 's that I could probably simplify this for, but i'm familiar with this for right now.

this is my night tonight, haha

I'll have to buy you a beer some day :)

EDIT: i am aware of the boo-boo in in my code, not declaring the blu and grn outputs... i fixed it

DOUBLE EDIT: I am now aware that I am an idiot, and the 2313 has no analog inputs.