Unable to upload to ATtiny814

Hello! I recently posted about my now-resolved problems using the Atmel-ICE programmer with PIO here .

Now, I want to use and configure the same functional platformio.ini file to program the ATtiny814, which is the first time I’ll be using. (here is its PIO page).

When I try to upload, I get a weird error telling me my avr.conf file has a syntax error. This sounds like the platform I needed to install for this chip, atmelmegaavr, could be competing with the previously installed atmelavr ?

I found this post which discusses a similar error but the proposed solution does not work for me.

Here is the error I get:

Configuring upload protocol...
AVAILABLE: custom
CURRENT: upload_protocol = custom
Uploading .pio\build\face\firmware.hex
avrdude error: syntax error [C:\Users\jcbsk\.platformio\packages\tool-avrdude\avrdude.conf:423]
avrdude error: unable to process system wide configuration file C:\Users\jcbsk\.platformio\packages\tool-avrdude\avrdude.conf

Here is the contents of avrdude.conf:

#
# Overall avrdude defaults; suitable for ~/.config/avrdude/avrdude.rc
#
default_parallel   = "/dev/parport0";
default_serial     = "/dev/ttyS0";
default_spi        = "";
# default_bitclock = 2.5;
default_linuxgpio  = "gpiochip0";   # This is line 423 which causes an error
allow_subshells    = no;

Here is my .ini file, with adjustments for the t814 chip.


[env:face]
platform = atmelmegaavr ; this line was modified for t814
board = ATtiny814 ; this line was modified for t814
framework = arduino
board_build.mcu = attiny814 ; this line was added for t814
board_build.f_cpu = 8000000L
board_fuses.hfuse = 0xDF    ;smallest flash section size 256 since not using a BSL w/ Atmel-ICE
board_fuses.lfuse = 0xE2    ;int 8MHz crystal (16MHz not working with less than 5V PSU)
board_fuses.efuse = 0xFE    ;BOD at 1.8V, perfect for low power
upload_protocol = custom
upload_port = usb
upload_flags =
    -C
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    atmelice_isp
    -e
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
src_filter= -<*> +<face>
build_flags = -DFACE_BUILD -Icommon
test_filter = test_common test_face
lib_deps =
	paulstoffregen/OneWire@^2.3.8

Any Idea what could be wrong? There is not a lot of posts on the t814 on PIO, and I didnt see a lot of stuff with atmelmegaavr either.

Thanks!

A syntax error there usually means a version mismatch between the avrdude binary (avrdude.exe) and the configuration file (avrdude.conf); for example, avrdude 6.x cannot read the config file meant for avrdude 7.x.

The problem is that, even though this is the officially recommended way using upload_flags, this is still fragile. It assumes that the avrdude folder that PlatformIO uses for this project is tool-avrdude. But it could also be a different version, e.g. tool-avrdude@<some version>.

Sadly PlatformIO does not have a $[platformio.packages_dir.tool-avrdude} sort of interpolation that always returns the actual used folder for a package.

So, you should look in your C:\Users\<user>\.platformio\packages\ folder and see what sort of tool-avrdude* folders exist, and adapt this path as needed.

1 Like

Thank you, I can upload now!
Also, I didn’t know but ATtiny814 uses UPDI and not ISP (though the 2 protocols use the same 6-pin header, just a different pinout) so it was important to change both these lines:

upload_flags =
    -C
    ${platformio.packages_dir}/tool-avrdude@1.70100.0/avrdude.conf ; HERE
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    atmelice_updi  ; HERE
    -e

I opened

to finally get this properly resolved.