Programming with "arduino as ISP"

Hi I have the good old arduino-isp (an arduino nano set up to be a programmer).
Now I am trying to get it to work with PlatformIO (and I am almost there after 2 hours)
First of all I want to complain a bit, because the documentation for that is hard to find and the PlatformIO does not ask my about uploading and is not suggesting anything in the platform.ini
This does not explain it: Generic ATtiny44 — PlatformIO latest documentation
here it is explained, however, it is so ugly: Atmel AVR — PlatformIO v6.1 documentation
it uses a custom command instead of “stk500v1”
I found that you can instead do it like this:

[env:attiny44]
platform = atmelavr
board = attiny44
framework = arduino
upload_protocol = stk500v1
upload_flags =
    -P$UPLOAD_PORT
    -b$UPLOAD_SPEED
upload_port = COM4
upload_speed = 19200

(but the flags part is vital)
Now what happens is that it is indeed finding the programmer on my COM and the atTiny, it is writing and verifying and finishing normally!!! Yes there is no error!
But then the AtTiny doesn’t do anything :frowning: It has an LED on Pin9 and it is supposed to be blinking.
The exactsame code works with the clonky ArduinoIDE (but since you will ask for it anyways, I attached the code

#include <Arduino.h>
#define PIN_LED_1 9
void setup()
{ pinMode(PIN_LED_1, OUTPUT);}
void loop() {
  digitalWrite(PIN_LED_1, HIGH);  delay(500);
  digitalWrite(PIN_LED_1, LOW);  delay(200);
}

Maybe the problem is related to that part of avrdudes output
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
I have no clue what the fuses do, but avrdude brings no such things when using ArduinoIDE (also safemode…?)
thanks if you could help meeeee :slight_smile:

In this config you’re using

Aka GitHub - SpenceKonde/ATTinyCore at 1.5.2.

Be mindful of the pinmapping.

When you write

You are telling it to control Arduino pin “D9”. Which is,

Pin PA1, the 12th pin of the package. Did you mean to control this pin, or some other pin?

Hi, thank you very much for your answer!!
I was messing around with the pins, it turns out something called “alternative pin mapping” is something that exists. Using pin 1 instead of pin 9 does work!
In your reply it sounds to me a bit like I am using a weired/uncommon config. Is there a way to make it work as it is in ArduinoIDE? Is there a switch?

No it’s not uncommon at all.

Can you link to what alternative pin mapping file you mean?

If you have setup Arduino IDE to use the same core in the same version (ATTiny core 1.5.2, not 2.0.0-dev), then it should work the same.


This is on my wall and I have crossed out, what is labeled “alternative pinout” at the bottom. Because using the ArduinoIDE “always” was the non-alternative pinout (i was using 1.8.13) and I got confused once.

But, of the Arduino IDE, not ATTinyCore. There’s no 1.8.13 version of the ATTiny core, it jumps from 1.5.2 to 2.0.0-dev. You’d have to look into the Tools → Boards → Board Manager menu to find out what version you’re using.

Very likely you’re using 2.0.0-dev as the core, since if you say D9 worked in the Arduino IDE, that is “PB1”.

But in the previous 1.5.2 version, “PB1” can be found as pin “D1” as linked here.

If you want PlatformIO to use the 2.0.0-dev core also, you need to add

platform_packages =
   maxgerhardt/framework-arduino-avr-attiny@2.0.0-dev
; tinyx4 doesn't exist anymore, is now "tinyx4_legacy".
; use new pin mapping instead.
board_build.variant = tinyx4_cw

to your platformio.ini. That’s the “switch” you’re looking for. Then, your original code should work just fine.

oh, i forgot that attiny had to be installed (And didn’t find its version) yeah it turns out that I have version 1.0.2 from David A. Mellis (attiny)
so I think I rather will stick to the new stuff.

…That is an entirely different core to what PlatformIO is using.

vs