Definition of my_board.json for Atmega32U4 custom board

I can’t reproduce that with the JSON given below.

Well, I have to fixup an extra , at line 43, but after that, uploading just straight jumps into the avrdude invocation.

AVAILABLE: avr109
CURRENT: upload_protocol = avr109
BeforeUpload(["upload"], [".pio\build\uno\firmware.hex"])
avrdude -v -p atmega32u4 -C C:\Users\Max\.platformio\packages\tool-avrdude@1.60300.200527\avrdude.conf -c avr109 -b 57600 -D -U flash:w:.pio\build\uno\firmware.hex:i

avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Max\.platformio\packages\tool-avrdude@1.60300.200527\avrdude.conf"

         Using Port                    : unknown
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "unknown": Das System kann die angegebene Datei nicht finden.



avrdude done.  Thank you.

*** [upload] Error 1

Produces by CLIpio run -t upload -v (or just “Project Tasks → Advanced → Verbose Upload”).

Okay, specifically using

{
    "build": {
      "core": "arduino",
      "extra_flags": "-DARDUINO_AVR_PROMICRO16",
      "f_cpu": "16000000L",
      "hwids": [
        [
          "0x1B4F",
          "0x9206"
        ],
        [
          "0x1B4F",
          "0x9205"
        ],
        [
          "0x2341",
          "0x8037"
        ],
        [
          "0x2341",
          "0x0037"
        ]
      ],
      "mcu": "atmega32u4",
      "usb_product": "SparkFun Pro Micro",
      "variant": "sparkfun_promicro"
    },
    "debug": {
      "simavr_target": "atmega32u4"
    },
    "frameworks": [
      "arduino"
    ],
    "name": "SparkFun Pro Micro 5V/16MHz",
    "upload": {
      "disable_flushing": true,
      "maximum_ram_size": 2560,
      "maximum_size": 28672,
      "protocol": "flip1",
      "require_upload_port": false,
      "speed": 57600,
      "use_1200bps_touch": false,
      "wait_for_upload_port": false      
    },
    "url": "https://www.sparkfun.com/products/12640",
    "vendor": "SparkFun"
  }

gives me

avrdude: Error: No matching USB device found
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: error reading signature data for part "ATmega32U4", rc=-1
avrdude: error reading signature data, rc=-1

avrdude done.  Thank you.

*** [upload] Error 1

so maybe that’s all what it needs.

Sorry, still the same error.

Please post the full error message.

Processing my_board (platform: atmelavr; board: leonardo; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/leonardo.html
PLATFORM: Atmel AVR (4.1.0) > Arduino Leonardo
HARDWARE: ATMEGA32U4 16MHz, 2.50KB RAM, 28KB Flash
DEBUG: Current (simavr) External (simavr)
PACKAGES:
 - framework-arduino-avr @ 5.1.0
 - tool-avrdude @ 1.60300.200527 (6.3.0)
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SPI @ 1.0
|-- Adafruit BusIO @ 1.14.1
|-- Wire @ 1.0
|-- Adafruit GFX Library @ 1.11.5
|-- TFT 22 ILI9225 @ 1.4.5
|-- ArduinoJson @ 6.21.2
Building in release mode
Checking size .pio\build\my_board\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  12.4% (used 318 bytes from 2560 bytes)
Flash: [===       ]  34.2% (used 9810 bytes from 28672 bytes)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
========================================================= [FAILED] Took 5.81 seconds =========================================================
 *  The terminal process "C:\Users\micha\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

So you have board = leonardo in your current environment? What’s the name and location of the board JSON file you custom-created?

My board is a custom board with a Atmega fresh from the factory. But I tried out the code with a leonardo board.

The name is my_board.json and it is located here:
xyz2.0_PlatformIO\platformio\boards

Screenshot

o_O that location doesn’t make sense.

If this is your project directory, you need to just put the board file in a folder called boards.

To make PlatformIO use your board definition then, you have to set board = <name of your board file without extension>, so e.g., board = custom_board with boards/custom_boards.json existing.

But I do have my file “my_board.json” under the folder path “platformio>boards”.

Screenshot

Again, the folder structure in the project must just be boards/my_board.json. Pull it out of the platformio folder.

Unfortunately the device is unknown. The “my_board.json” is no outside of the platformio folder.

Try using this exact board file that uses flip1.

When I press the Reset button, that error message appears:

Not pressing the reset button:
Screenshot

I was able to connect the board using flip, so in principle, it should work.