(Solved) Uploading to Mightycore/ATmega1284 Fails

Coding an Arduino project and using the Mightycore ATmega1284 (not the P version). The project compiles properly, but fails to upload.

In the platformio.ini I have the following:

platform = atmelavr
board = mightycore1284
framework = arduino
upload_protocol = arduinoisp
lib_install = 1, 54

Upload fails with:

Auto-detected: /dev/cu.SLAB_USBtoUART
Uploading .pioenvs/mightycore1284/firmware.hex
avrdude: Error: Invalid -P value: '/dev/cu.SLAB_USBtoUART'

What am I missing?

Looks like the issue stemmed from the wrong upload_protocol. Using “arduino” instead of “arduinoisp” uploaded the program. However, the program produces garbage, so something went wrong with the upload.

Still looking for the right solution.

Found the issue. Hopefully this will help someone else out there.

PIO has a default set of boards that it works with. The mightycore1284 has a JSON definition file in:

(On a Mac) ~/.platformio/platforms/atmelavr/boards/mightycore1284.json

The file needed to be altered to read the following:

  "build": {
    "core": "MightyCore",
    "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_ATmega1284",
    "f_cpu": "20000000L",
    "mcu": "atmega1284",
    "variant": "mightycore"
  "frameworks": [
  "name": "MightyCore ATmega1284",
  "upload": {
    "maximum_ram_size": 16384,
    "maximum_size": 130048,
    "protocol": "arduino",
    "require_upload_port": true,
    "speed": 115200
  "url": "https://www.tindie.com/products/MCUdude/dip-40-arduino-compatible-development-board",
  "vendor": "Mcudude"

Two changes from the original file:

  1. Remove the “P” from the board type

"mcu": "atmega1284P” to "mcu": "atmega1284"

  1. Change the clock frequency

"f_cpu": “16000000L" to “f_cpu": "20000000L"

I am working with a 20 MHz clock and the default of 16 MHz would produce the garbage, even thought the program was successfully uploaded.

Alternatively, the clock speed can be set in the platformio.ini file. Below worked after making the changes:

platform = atmelavr
board = mightycore1284
framework = arduino
upload_protocol = arduino
board_f_cpu = 20000000L