After some extensive googling I have the following:
avrdude -p m1284p -c stk500v2 -P usb:16:79 -v
avrdude: Version 6.3, compiled on Dec 20 2018 at 23:10:28
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/opt/local/etc/avrdude.conf"
User configuration file is "/Users/zoonman/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb:16:79
Using Programmer : stk500v2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 001D2C991679
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500 Version 2.x firmware
Programmer Model: AVRISP mkII
Hardware Version: 1
Firmware Version Master : 1.24
Vtarget : 4.9 V
SCK period : 4.00 us
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
I had to install avrdude using MacPorts and started running it from command line.
Because I don’t have FT232 installed I suspect it cannot program the controller because RESET line is not pulled up to +5V.
Should I install some resistor and check?
Use the -v option (e.g. pio run -v -t upload) to see what commandline is executed for the upload so that you can adjust your upload_flags to match your previous successful run.
<lambda>(["upload"], [".pioenvs/atmega1284/firmware.hex"])
AVAILABLE: avrsip2
CURRENT: upload_protocol = avrsip2
BeforeUpload(["upload"], [".pioenvs/atmega1284/firmware.hex"])
Use manually specified: usb:16:79
*** [upload] could not open port usb:16:79: [Errno 2] No such file or directory: 'usb:16:79'
I figured out that 3.3V power supply supposed to be removed from LCD and after programmer starts working flawlessly.
Looks like ST7735 SDA holds MOSI and it messes up programmer.