Trouble uploading to ATtiny 2313a

As the topic name suggests i am having some difficulty with uploading to an ATtiny23213a.
The plan is top build an alarm clock (my current one is dying on me) and i have a couple of 2313’s lying around, and they would suit the project quite well. Now i have only really used ATtiny 13’s so far, but i thought the process is rather similar (just the ground pin is in a different spot)
But every time i hit the 'upload using programmer i get a long list of device id’s i think is what they are, as an error message.

Arduino: 1.8.12 (Windows 10), Board: "ATtiny2313(a)/4313 (No bootloader), Enabled, ATtiny2313/ATtiny2313A, 8 MHz (internal), EEPROM retained, B.O.D. Disabled (saves power), no, Enabled, Port A (pins 2,3,17)"

Sketch uses 1222 bytes (59%) of program storage space. Maximum is 2048 bytes.
Global variables use 92 bytes (71%) of dynamic memory, leaving 36 bytes for local variables. Maximum is 128 bytes.
avrdude: AVR Part "attiny2313a" not found.

Valid parts are:
  uc3a0512 = AT32UC3A0512
  c128     = AT90CAN128
  c32      = AT90CAN32
  c64      = AT90CAN64
  pwm2     = AT90PWM2
  pwm216   = AT90PWM216
  pwm2b    = AT90PWM2B
  pwm3     = AT90PWM3
  pwm316   = AT90PWM316
  pwm3b    = AT90PWM3B
  1200     = AT90S1200
  2313     = AT90S2313
  2333     = AT90S2333
  2343     = AT90S2343
  4414     = AT90S4414
  4433     = AT90S4433
  4434     = AT90S4434
  8515     = AT90S8515
  8535     = AT90S8535
  usb1286  = AT90USB1286
  usb1287  = AT90USB1287
  usb162   = AT90USB162
  usb646   = AT90USB646
  usb647   = AT90USB647
  usb82    = AT90USB82
  m103     = ATmega103
  m128     = ATmega128
  m1280    = ATmega1280
  m1281    = ATmega1281
  m1284    = ATmega1284
  m1284p   = ATmega1284P
  m1284rfr2 = ATmega1284RFR2
  m128rfa1 = ATmega128RFA1
  m128rfr2 = ATmega128RFR2
  m16      = ATmega16
  m1608    = ATmega1608
  m1609    = ATmega1609
  m161     = ATmega161
  m162     = ATmega162
  m163     = ATmega163
  m164p    = ATmega164P
  m168     = ATmega168
  m168p    = ATmega168P
  m168pb   = ATmega168PB
  m169     = ATmega169
  m16u2    = ATmega16U2
  m2560    = ATmega2560
  m2561    = ATmega2561
  m2564rfr2 = ATmega2564RFR2
  m256rfr2 = ATmega256RFR2
  m32      = ATmega32
  m3208    = ATmega3208
  m3209    = ATmega3209
  m324p    = ATmega324P
  m324pa   = ATmega324PA
  m324pb   = ATmega324PB
  m325     = ATmega325
  m3250    = ATmega3250
  m328     = ATmega328
  m328p    = ATmega328P
  m328pb   = ATmega328PB
  m329     = ATmega329
  m3290    = ATmega3290
  m3290p   = ATmega3290P
  m329p    = ATmega329P
  m32m1    = ATmega32M1
  m32u2    = ATmega32U2
  m32u4    = ATmega32U4
  m406     = ATMEGA406
  m48      = ATmega48
  m4808    = ATmega4808
  m4809    = ATmega4809
  m48p     = ATmega48P
  m48pb    = ATmega48PB
  m64      = ATmega64
  m640     = ATmega640
  m644     = ATmega644
  m644p    = ATmega644P
  m644rfr2 = ATmega644RFR2
  m645     = ATmega645
  m6450    = ATmega6450
  m649     = ATmega649
  m6490    = ATmega6490
  m64m1    = ATmega64M1
  m64rfr2  = ATmega64RFR2
  m8       = ATmega8
  m808     = ATmega808
  m809     = ATmega809
  m8515    = ATmega8515
  m8535    = ATmega8535
  m88      = ATmega88
  m88p     = ATmega88P
  m88pb    = ATmega88PB
  m8u2     = ATmega8U2
  t10      = ATtiny10
  t11      = ATtiny11
  t12      = ATtiny12
  t13      = ATtiny13
  t15      = ATtiny15
  t1604    = ATtiny1604
  t1606    = ATtiny1606
  t1607    = ATtiny1607
  t1614    = ATtiny1614
  t1616    = ATtiny1616
  t1617    = ATtiny1617
  t1624    = ATtiny1624
  t1626    = ATtiny1626
  t1627    = ATtiny1627
  t1634    = ATtiny1634
  t20      = ATtiny20
  t202     = ATtiny202
  t204     = ATtiny204
  t212     = ATtiny212
  t214     = ATtiny214
  t2313    = ATtiny2313
  t24      = ATtiny24
  t25      = ATtiny25
  t26      = ATtiny26
  t261     = ATtiny261
  t28      = ATtiny28
  t3216    = ATtiny3216
  t3217    = ATtiny3217
  t4       = ATtiny4
  t40      = ATtiny40
  t402     = ATtiny402
  t404     = ATtiny404
  t406     = ATtiny406
  t412     = ATtiny412
  t414     = ATtiny414
  t416     = ATtiny416
  t417     = ATtiny417
  t424     = ATtiny424
  t426     = ATtiny426
  t427     = ATtiny427
  t4313    = ATtiny4313
  t43u     = ATtiny43u
  t44      = ATtiny44
  t441     = ATtiny441
  t45      = ATtiny45
  t461     = ATtiny461
  t5       = ATtiny5
  t804     = ATtiny804
  t806     = ATtiny806
  t807     = ATtiny807
  t814     = ATtiny814
  t816     = ATtiny816
  t817     = ATtiny817
  t824     = ATtiny824
  t826     = ATtiny826
  t827     = ATtiny827
  t84      = ATtiny84
  t841     = ATtiny841
  t85      = ATtiny85
  t861     = ATtiny861
  t88      = ATtiny88
  t9       = ATtiny9
  x128a1   = ATxmega128A1
  x128a1d  = ATxmega128A1revD
  x128a1u  = ATxmega128A1U
  x128a3   = ATxmega128A3
  x128a3u  = ATxmega128A3U
  x128a4   = ATxmega128A4
  x128a4u  = ATxmega128A4U
  x128b1   = ATxmega128B1
  x128b3   = ATxmega128B3
  x128c3   = ATxmega128C3
  x128d3   = ATxmega128D3
  x128d4   = ATxmega128D4
  x16a4    = ATxmega16A4
  x16a4u   = ATxmega16A4U
  x16c4    = ATxmega16C4
  x16d4    = ATxmega16D4
  x16e5    = ATxmega16E5
  x192a1   = ATxmega192A1
  x192a3   = ATxmega192A3
  x192a3u  = ATxmega192A3U
  x192c3   = ATxmega192C3
  x192d3   = ATxmega192D3
  x256a1   = ATxmega256A1
  x256a3   = ATxmega256A3
  x256a3b  = ATxmega256A3B
  x256a3bu = ATxmega256A3BU
  x256a3u  = ATxmega256A3U
  x256c3   = ATxmega256C3
  x256d3   = ATxmega256D3
  x32a4    = ATxmega32A4
  x32a4u   = ATxmega32A4U
  x32c4    = ATxmega32C4
  x32d4    = ATxmega32D4
  x32e5    = ATxmega32E5
  x384c3   = ATxmega384C3
  x384d3   = ATxmega384D3
  x64a1    = ATxmega64A1
  x64a1u   = ATxmega64A1U
  x64a3    = ATxmega64A3
  x64a3u   = ATxmega64A3U
  x64a4    = ATxmega64A4
An error occurred while uploading the sketch
  x64a4u   = ATxmega64A4U
  x64b1    = ATxmega64B1
  x64b3    = ATxmega64B3
  x64c3    = ATxmega64C3
  x64d3    = ATxmega64D3
  x64d4    = ATxmega64D4
  x8e5     = ATxmega8E5
  avr128da28 = AVR128DA28
  avr128da32 = AVR128DA32
  avr128da48 = AVR128DA48
  avr128da64 = AVR128DA64
  avr128db28 = AVR128DB28
  avr128db32 = AVR128DB32
  avr128db48 = AVR128DB48
  avr128db64 = AVR128DB64
  avr32da28 = AVR32DA28
  avr32da32 = AVR32DA32
  avr32da48 = AVR32DA48
  avr32db28 = AVR32DB28
  avr32db32 = AVR32DB32
  avr32db48 = AVR32DB48
  avr64da28 = AVR64DA28
  avr64da32 = AVR64DA32
  avr64da48 = AVR64DA48
  avr64da64 = AVR64DA64
  avr64db28 = AVR64DB28
  avr64db32 = AVR64DB32
  avr64db48 = AVR64DB48
  avr64db64 = AVR64DB64
  ucr2     = deprecated, use 'uc3a0512'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

But when i switched the board to 4313 i got the ‘Yikes wrong device ID’ as expected.
I’ve tried with 2 different chip’s with the same result.
Any thoughts ?

Do you use a custom boards.txt file?

It looks like the IDE is passing the MCU ID “attiny2313a” to avrdude, and avrdude doesn’t recognise that. If you can change this to “ATtiny2313”, then avrdude should recognise correctly.

Hmmm OK, I managed to upload using a different core
this one
but that is interesting,
Yeah i think i got it to work by doing ‘show verbose output during upload’
Copying the avrdude command command gave me :

C:\Users\deva_\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\deva_\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/etc/avrdude.conf -v -V -pattiny2313a -cstk500v1 -PCOM3 -b19200 -Uflash:w:C:\Users\deva_\AppData\Local\Temp\arduino_build_345956/AlarmClock.ino.hex:i 

and all the errors of course.
then i removed the ‘a’ from

pattiny2313a

did an ‘export compiled binary’ and replaced the file location with the resulting .ino.hex file
so then it looked like this

C:\Users\deva_\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\deva_\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/etc/avrdude.conf -v -V -pattiny2313 -cstk500v1 -PCOM3 -b19200 -Uflash:w:C:\Data\Arduino\Sketches\ATtiny\AlarmClockAlarmClock.ino.hex:i

Then it complained that the access was denied to the com port, but closing all instances of the IDE and trying again, I succeeded.
Great thanks !!

Now where is that particular name ‘attiny2313a’ stored ? somewhere in the core i guess…
or where is the ‘attiny2313’ stored ? Is that in the ‘avrdude.conf’ file ?

I should probably just report it as a bug.
Anyway many thanks, i have a work around and some more investigating to do.

OK for now i just copied the whole definition of the ‘ATtiny2313’ in the avrdude.conf file
and added an ‘a’ for one instance to both the ‘id’ & ‘desc’ and now it works (until i update the IDE i guess)

#------------------------------------------------------------
# ATtiny2313a
#------------------------------------------------------------

part
     id            = "t2313a";
     desc          = "ATtiny2313a";
     has_debugwire = yes;

Still it would be better if the core provided the proper description. Next step.

I’m running IDE 1.8.13 and my boards.txt file doesn’t mention any of the ATTiny series and a search of the whole Arduino sub-folders didn’t find anything meaningful either.

I’m guessing that you downloaded a “core” that has the ATTiny2313a in it. I think I put my cores into the MySketchbook\hardware folder but I can’t be sure.

There will be a boards.txt file associated with the core that has the 2313a in it. There’s probably a line in the text file like: .build.mcu=attiny2313a - that’s where the bit comes from for avrdude.

According to Microchip, there’s no practical difference between the 2313 and the 2313a so dropping the ‘a’ should be ok.

I don’t know much about avrdude.conf to go poking around in it and copy the attiny2313 section and add the ‘a’ variant.

I suppose it’d be easiest to find that boards.txt file and remove the ‘a’ from the build.mcu line.

Of course I could be completely wrong, in which case somebody wiser will jump in and provide the correct solution.

1 Like

Yep correcting the name in the boards.txt file works as well. I undid the changes to avrdude.conf to verify.
All that remains is the bug report on github. Thanks again.

Which core were you using (the one that’s broken)?

SpenceKonde ATTinyCore v 1.5.2 (i was on 1.4.x but updated when i had an issue, but that didn’t fix anything)

The problem is that the core is using the wrong version of avrdude.conf. It’s supposed to be using the one that I package with the core. But it appears to be instead using the one that the IDE comes with. I am not sure why this is, and it’s not the one that gets used when I call it. I get

C:\arduino-1.8.13-portable\portable\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\arduino-1.8.13-portable\portable\packages\ATTinyCore\hardware\avr\1.5.0/avrdude.conf -v -pattiny2313a -cstk500v1 -PCOM11 -b19200 -Uflash:w:C:\Users\Spence\AppData\Local\Temp\arduino_build_579291/sketch_apr25a.ino.hex:i 

and this problem is almost certainly caused by not selecting an option from tools → programmer, that is arduino as ISP was selected when he was pointing the IDE at an official arduino board. Now, there will be a blank spot next to the programmer option where it normally shows the selected programmer; when this happens the platform.txt from the OTHER CORE is being used, and the one from the current core is ignored. In the case of these parts, the manifestation is that it just uses the wrong avrdude.conf, so some parts work and others don’t. If the architectures are incompatible, you get null pointer errors, and switching betrween my two modern AVR cores, you get errors about {bootloader.CODESIZE} or {bootloader. BOOTEND} not being a valid memory type. The bottom line is that you should always make sure that the programmer is actually selected. 1.8.13 made it so you can’t select programmers for other hardware packages, but it didn’t do anything to handle the case when you already have one selected and don;'t change it.

Well as i mentioned on github already, i can’t get the IDE to use the proper file. The selection is never empty, and when i select a different programmer and switch back to ‘Arduino as ISP’ it still picks the wrong file. That i am switching between cores makes sense (even just to upload to an ATTiny i must first load ArduinoISP onto my UNO, then upload to the ATTiny, then i upload a version of blink onto the UNO to test the UART etc.
To me the whole structure seems faulty, where do all those definitions in the ‘wrong’ avrdude.conf file come from ? Either there should be just a single file, or there should be just a single entry for each board.

What version of the IDE are you running?

Do you see multiple copies of Arduino as ISP in the tools → programmers menu? If so it sounds like a pre-1.8.13 version; one of those is the one that is defined by ATTinyCore and will work…I used to have (ATTinyCore) after all of my programmers as the workaround for this, but after the new version had been out for a bunch of months with no major problems reported (the bug I’m talking about here is the only one I know of, and it’s easily worked around - it’s definitely the best IDE version yet), they were deleted from the names when I overhauled the names of the programmers recently.

I am running 1.8.12, but i will get around to updating at some point. This has been a rather educative thread for me. I kept having to change the settings for other boards every time i switched between them, but now i know how i can set the default setup.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.