Difficulty for programming Attiny2313a

Hello Friends,
For testing my attiny2313a, I used the blink code and a AVR Dragon programmer and attiny core as hardware.

I don't have any errors but the led don't blink.
I missed something but I don't know what that?

My setting are :

The pin used is D7 (pin 9) and the file .hex code in the atmel studio.

Someone can help me please, Thanks

Would it help if I posted a picture of my puzzled face?

Sorry, I'm not sur to understand what do you mean?
Your puzzled face :smile:

pin 9 is PORTD5 if you are using the PDIP version

This should turn ON the LED at least

DDRD |= 1<<5;
PORTD |= 1<<5;

I based in the mapping below :
F0MKOPOIRXTRI0O

I used the DIP version, his reference is : ATTINY2313A-PU.
An I tested this attiny by the following simple blink code :

int led=7;

void setup() {
  
  pinMode(led, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);   
  delay(1000);                     
  digitalWrite(led, LOW);    
  delay(1000);                       
}

I connected also your proposed pin but no thing happen.

Did you try the code I wrote? The LED should turn ON even if you got the wrong clock, etc.

I just have tested your code but no thing happen!
with and without bootloader file

Assuming the IDE gave you confirmation of a successful upload, how and what else do you have connected ?

Hi friend,
I used the IDE juste for obtaining the .hex file.
After I upload this file in the attiny2313a by AVR Dragon.
I connected my attiny like that:
Pin 20 --> 5V
Pin 10 --> GND.
Pin 9 --> Led.
The wiring is not complicated.

Migh be the problem come from the file of management card in the IDE or the fuse in the ATMELSTUDIO.
Migh be another cause, I don't know

Pin 1 (Reset) needs to be pulled HIGH, i normally do via a 10K resistor, or it won't start up.
I do hope you are using a current limiting resistor icm the LED.

And that confirms a successful upload ?
The IDE creates the correct file, there was a small error in the boards.txt, which does not distinguish between the 2313 & 2313a, or well it tells avrdude incorrectly, but for the hex file it should be all good,

For pin 1 , I will connected that to HIGH via a resistor (10K) and I will inform after testing tomorrow.
About the Led, of course, I'm using a current limiting resistor.

My AVR Dragon confirm me a successful upload.

The IDE board consider the 2313 and 2313a as same.

Yeah i know, but if you use avrdude to upload, it passes on confusing data, but you don't use avrdude.

Good.

Most people do, but when you forget about the reset pin, it doesn't hurt to ask.

Hi DEVA,
I connected the reset pin to 10k resistor and the other pin of resistor to 5V,but nothing happen.
for information : the ISP clock is set : 125Khz in the ATMEL STUDIO et 8 Mhz in the IDE.

The 8MHz in the IDE revers to the CPU clock, and should be set to 8MHz internal,

But if you set

int led=7;

Then you have connected the LED to the wrong pin.
ATtiny2313
You have it connected to pin 7 which is GPIO 5
But you have defined it as GPIO 7 which is pin 9

Yes, that's right , GIPO 7 = pin 9 but the problem still the same.

By now i don't really believe you anymore. If the uploader confirms the upload and the connections are correct, it should work.
Even though the board you are using to power the chip is known to be of poor quality , (the regulators have apparently have no heatsink to speak of) the 2313's power requirements are so low it should not pose an issue, also because the 2313 will be happy with 2v at 8MHz.
The only thing i do differently is that is use Arduino IDE and an UNO as ISP uploader.
So then there is just a general advice. Disconnect everything, and re-connect everything, check that the ATtiny is actually getting the 5v. Confirm that the led is working by connecting it between 5v+ ( instead of GPIO 7) & GND
Confirm that the wires are actually making contact with the Pins of the IC (all looks good, but looking is no confirmation)
If that fails, how about just using the IDE to upload to the ATtiny ?

you can see in this picture that the .hex file is correcly upload in the attiny.

This power supply provid 5V correctly and can porvid also 3.3V.
This CPU can fonction between 1,8v and 5V.

I tested this method also.

before asking help i already do that many times and I chang many thing without succes.

My led work correctly when i connect it directly to 5V.

yes I check that, all wires are making contact

If you have another method, why not?

I think, This night, I will change the CPU (Attiny2313a), may be it not function.

There was no real doubt there, and i am not familiar with Atmel studio.

up to 5.5v even, but not all clock frequencies are available at lower voltages, but this is not the issue here.

Ah. Also no success there on the outcome, but the upload was successful ?

I know, the reason i ask again is that in doing so people at times all of a sudden see that this wire isn't in that hole but in the one next to it, like with pin 7 with you). It never hurts to remind someone to talk a deep breath, have some coffee and start over. But i trust you have.

You said you tried that.

That is possible, and putting another one to exclude that as a possibility is a good idea.

Because if it's not the connections, it's not the sketch, it's not the upload method, it's not even the power supply, then that leaves the Chip itself. Let's hope it's that, otherwise i'm stumped.

1 Like

good news friend,
The problem was the Chip itself, that fucntion with new one, but not like what I expected, because , I have two follwing unanswered questions :

1 ) the delay of blinking in th code is 1 second, but in my test the blinking is about 8 second! why?
2) the code uploaded in the new CPU was without bootloader? that's mean this CPU not need bootloader like attiny85, Why?

N.B : the resistor of reset have not any impact on operation

I'd say both questions share an answer, though it's guess work for me. The bootloader on an ATtiny13 is not more than setting the fuses for the clockspeed, and i recon that is why.

It may not have now, it is after all a GPIO pin in input mode with a tiny capacitor holding the input value.

1 Like