PlatformIO Community

Attiny USB-ISP with Arduino IDE works and with platformIO very strange behaviour? (Solution: pinout counterclockwise)

Hey!

The Upload with the Arduino IDE 1.8 and my USB-ISP works.

Also under platformIO i got a success message - BUT the exakt(!!!) same Sketch (Source-Code) doesn’t work as espected. Some strange behaviour occured, like analogWirte is not starting, digitalWrite for a LED is skipped. I tested also other sketeches, same thing.

Fuses were set, MHz same, wiring same, source code same, UBS-ISP same, ATtiny same, output not the same… WHAHA!

Arduino IDE 1.8 output

   Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: STK500
         Hardware Version: 10
         Firmware Version Master : 2.10
         Topcard         : Unknown
         Vtarget         : 3.3 V
         SCK period      : 8.7 us
         Varef           : 3.3 V
         Oscillator      : 1.229 MHz

platformio.ini

[env:attiny24]
platform = atmelavr
board = attiny24
framework = arduino
upload_port = COM5
upload_protocol = stk500v2
upload_speed=9600
upload_flags =
  -P$UPLOAD_PORT
  -b$UPLOAD_SPEED
board_build.f_cpu = 1000000L
board_fuses.lfuse = 0x62
board_fuses.hfuse = 0xDF
board_fuses.efuse = 0xFF

I appreciate any help.

Edit: Just tested Arduino UNO as ISP with platformIO and same strange behviour…
I’ve tested 2nd pc and other Attiny with other sketeches… arrrrr

In the Arduino IDE, what version of the ATTiny core (Tools → Board → Board Manager) is installed? That has to match what PlatformIO is using for same results.

Thanks for your reply
I’m using in the Arduino IDE: GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8

Is there a way to include / use this Core in PlatformIO?

PlatformIO uses that too, the question is, what does the Arduino IDE board manager say what version you have installed?

1 Like

And also, a screenshot of the Arduino IDE → Tools menu would be good, so that all these settings can be equalized.

1 Like

Hello Max,

thank you again - With your Infos I investigated my code once a gain I found out, that the PINs were not initialized in the same way.

The Arduino IDE takes my PIN declarion but platformIO wants them counterclockwise… strange.
I’m not sure why this is so, but it works? Do you have an explanation for this?

Thank you for your help - you need a ko-fi account :slight_smile:

Greetings

Edit/Solution:
add to platformio.ini
board_build.variant = tinyX4_reverse

[env:attiny24]
platform = atmelavr
board = attiny24
framework = arduino
upload_port = COM5
upload_protocol = stk500v2
upload_speed=9600
upload_flags =
  -P$UPLOAD_PORT
  -b$UPLOAD_SPEED
board_build.f_cpu = 1000000L 
board_build.variant = tinyX4
;board_build.variant = tinyX4_reverse
board_fuses.lfuse = 0x62
board_fuses.hfuse = 0xDF
board_fuses.efuse = 0xFF
1 Like

Ah you found the error. Per

PlatformIO defaults to the tinyX4 variant, which I would argo is the “non-reversed” layout with respect to
tinyX4_reverse, so you must have selected the reverse layout in the tools menu?

1 Like

In the Arduino IDE - Tools - pinmappig is clockwise
and with platformIO i have to use tinyX4_reverse than everything works fine :slight_smile:

1 Like