Atmel Ice not working with some atmel chips

I try to program the following atmel devices in my projects: ATMega32, ATMega328P, AtTiny85 and Attiny 4313.
I setup a test project for each of them in platformio with a supersimple program to just alter some io pins. My platformio.ini file for all of them looks like this:

[env:atmel]

platform = atmelavr
board = different for each device of course
framework = arduino

upload_protocol = atmelice_isp
upload_flags =
-e
upload_port = usb

I attach my atmel Ice to the devices and try program them via platformio/avrdude. It works for ATMega32 and ATMega328P. It does NOT work for Attiny85 and Attiny 4313 with the following error:

avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2141

I then tried to program all four chips via the Atmel Studio. Exactly the same hardware setup. I works without any trouble

Checking the atmel ICE in the device manager of windows tells me that VID and PID are exactly as they need to be.

In a post in this forum I found the following line for PlatformIO Core CLI:

C:\Users\<myuser>\.platformio\packages\tool-avrdude\avrdude -v  -C "C:\Users\<myuser>\.platformio\packages\tool-avrdude\avrdude.conf"  -c atmelice_isp  -p t4313

Having the 4313 attached to my atmel ICE prints the following output:
avrdude: Version 7.1-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Users\volke\.platformio\packages\tool-avrdude\avrdude.conf

         Using Port                    : usb
         Using Programmer              : atmelice_isp
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny4313
         Chip Erase delay              : 9000 us
         PAGEL                         : PD4
         BS2                           : PD6
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                 65     6     4    0 no        256    4      0  4000  4500 0xff 0xff
           flash                  65     6    32    0 yes      4096   64     64  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          2    1      0     0     0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description     : Atmel-ICE (ARM/AVR) in ISP mode
         ICE HW version  : 0
         ICE FW version  : 1.42 (rel. 161)
         Serial number   : J41800041661
         SCK period      : 8.00 us
         Vtarget         : 4.94 V


avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e920d (probably t4313)

avrdude done.  Thank you.

I could really need some help here.

You might be running into a “gotcha” where depending on which board (and with it the used Arduino core) is selected, it choses a different package version for tool-avrdude, namely 7.1 for

but the older 6.3 for all others.

All package versions should be printed at the top of the upload process. Do they differ for tool-avrdude?

If yes, you can try and counteract it by overriding the package version with

platform_packages =
   tool-avrdude@~1.70100.0

in the platformio.ini.

My python file was exactly as you posted it for the too-avrdude…

Anyway
During programing, the console told me

  • tool-avrdude @ 1.60300.200527 (6.3.0)

Why did my setup decide for dude 1.603 instead of 1.701 as stated in the platform.py ?
Brave as I am I just added

“tiny”,
to the list in the if statement

Using your platform.ini snippet works perfectly!
Having my additional line in the platform.ini also works without the snippet (Most likely until I update the atmel platform in Platform IO => My change is gone!?

Thank your for the help

Exactly. You should not make modifications to platform/atmelavr code if you can get away with platformio.ini options. Doing it via platformio.ini also makes the project portable between computers without having to modify that code.