CMSIS-DAP download failed

I have s customed upload tool but it does’t work. What should I do? Thanks.


Additionally, it worked with Keil.



The stm32 platform is capable of uploading via CMSIS-DAP using OpenOCD, it seems it was just forgotten to include it in the protocols of the board file.

Create a new folder called boards in your project directory. Create a file named custom_STM32F407IGT6.json with content

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32F407xx -DSTM32F4",
    "f_cpu": "168000000L",
    "hwids": [
      [
        "0x1EAF",
        "0x0003"
      ],
      [
        "0x0483",
        "0x3748"
      ]
    ],
    "mcu": "stm32f407igt6",
    "product_line": "STM32F407xx"
  },
  "debug": {
    "default_tools": [
      "cmsis-dap"
    ],
    "jlink_device": "STM32F407IG",
    "openocd_extra_args": [
      "-c",
      "reset_config none"
    ],
    "openocd_target": "stm32f4x",
    "svd_path": "STM32F40x.svd"
  },
  "frameworks": [
    "cmsis",
    "stm32cube",
    "libopencm3"
  ],
  "name": "STM32F407IG (192k RAM. 1024k Flash)",
  "upload": {
    "disable_flushing": false,
    "maximum_ram_size": 196608,
    "maximum_size": 1048576,
    "protocol": "cmsis-dap",
    "protocols": [
      "blackmagic",
      "dfu",
      "jlink",
      "serial",
      "stlink",
      "cmsis-dap"
    ],
    "require_upload_port": true,
    "use_1200bps_touch": false,
    "wait_for_upload_port": false
  },
  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ig.html",
  "vendor": "Generic"
}

And in your platformio.ini, change to

board = custom_STM32F407IGT6

Remove any upload_protocol settings. Then, uploading should just work.

1 Like

OHHHH! It worked flawlessly. Thank you ever so much for your invaluable help!

Suppose I want to carry out the same task not only on the STM32F407ZET6 but also on other microcontrollers like the STM32F103. How precisely should I modify the “custom_STM32F407ZET6.json” file? Is it merely a matter of replacing “IG” in the content with “ZE”?
image