PlatformIO Community

Stk500 dont work with PIO but with AVR Studio

hello,

before i went to this option to asking for help here, i looked in every post i found but nothing helps me out.

i´ll use the arduino framework to develop code for a bare atmega328p in platformio. the code is compiling without any errors. if i press upload, pio recognize my stk500 programmer and also the right upload port. everthing looks fine until here but then i get the common stk500 out of sync error ten times.
cuz the firmware hex was build via platformio i went to avr studio 4, enter avr programming mode, choose my chip and load the firmware without any problems.
i dont want to burn any bootloader, cuz its not needed (i dont use any usb flashing mode). the code is working well with 8mhz internal rc oscilator selected (option fuses set by avr studio 4) and without burning a bootloader - flashed by avr studio and nonchanged setup. i did not code in avr studio but pio … i just used avr studio 4 to flash the pio builded hex file

so i cant figure out why platformio isnt able to interact with my stk500 to flash the chip.

does anyone have a solution? i really thank you!

Since you’re using a programmer, try using the Upload with Programmer option, not the Upload option (which works with a bootloader).

How have you configured your platformio.ini? Something somewhat similar to the following I hope (which the correct fuses and serial port, obviously! :wink: )?

[env:ATmega328]
platform = atmelavr
framework = arduino
board = ATmega328
board_build.f_cpu = 8000000L
board_fuses.hfuse = 0xDA
board_fuses.lfuse = 0xFF
board_fuses.efuse = 0xFD
upload_protocol = stk500v1
upload_flags =
    -P$UPLOAD_PORT
upload_port = COM5
1 Like

thanks for the reply!! :slight_smile:

i expected this would be the solution cuz i thought it logically the same but wasnt able to configure out. but it doesn´t solve the problem. the “not in sync” message appear again.

1 Like

One verbose upload log (pio run -t upload -v) please and maybe a reference for a successful upload log with AVRStudio.

1 Like

wonderful … i got it to work.
i put the programmer on a usb hub cuz i ran out of ports in the actual setup. also i changed ATmega328 to ATmega328p
my platformio file looks like this now:

[env:ATmega328]
platform = atmelavr
framework = arduino
board = ATmega328p
board_build.f_cpu = 8000000L
board_fuses.hfuse = 0xDA
board_fuses.lfuse = 0xFF
board_fuses.efuse = 0xFD
upload_protocol = stk500
upload_flags =
    -P$UPLOAD_PORT
upload_port = COM6

i also open up the terminal and type in:

platformio run -t program

if i just use upload on the bar it will try to upload to the target. its also writing to but i get a verification error. not so in upoload to programmer mode. would be nice if there would be a bar icon to choose for uploading to target or programmer.

i thank you all!! <3

There is also the PIO sidebar icon -> Upload using Programmer option :wink:

I’d show you a screenshot, but my PlatformIO install just broke :frowning: