Custom board issue

Hi All,

I hoped this would be simple, but for some reason my plaformIO core will not recognize my custom board file. I created a boards folder in my core_dir (assumed it is %HOMEPATH%.platformio) in which I placed a myboard.json file. This is what I placed in it (I used the Adafruit feather nrf52832 as a template):

{
"build": {
  "arduino":{
    "ldscript": "nrf52832_s132_v6.ld"
  },
  "core": "nRF5",
  "cpu": "cortex-m4",
  "extra_flags": "-DNRF52832_XXAA -DNRF52",
  "f_cpu": "64000000L",
  "hwids": [
    [
      "0x239A",
      "0x8029"
    ],
    [
      "0x239A",
      "0x0029"
    ],
    [
      "0x239A",
      "0x002A"
    ],
    [
      "0x239A",
      "0x802A"
    ]
  ],
  "usb_product": "Feather nRF52832 Express",
  "mcu": "nrf52832",
  "variant": "feather_nrf52832",
  "bsp": {
    "name": "adafruit"
  },
  "softdevice": {
    "sd_flags": "-DS132",
    "sd_name": "s132",
    "sd_version": "6.1.1",
    "sd_fwid": "0x00B7"
  },
  "zephyr": {
     "variant": "nrf52_adafruit_feather"
  }
},
"connectivity": [
  "bluetooth"
],
"debug": {
  "jlink_device": "nRF52832_xxAA",
  "svd_path": "nrf52.svd"
},
"frameworks": [
  "arduino",
  "zephyr"
],
"platforms": ["%LIST_WITH_COMPATIBLE_PLATFORMS%"],
"name": "rak4600",
"upload": {
  "maximum_ram_size": 65536,
  "maximum_size": 524288,
  "require_upload_port": true,
  "speed": 115200,
  "protocol": "nrfutil",
  "protocols": [
    "jlink",
    "nrfjprog",
    "nrfutil",
    "stlink",
    "cmsis-dap",
    "blackmagic"
  ]
},
"url": "https://www.adafruit.com/product/3406",
"vendor": "RAK Wireless"

}

Using myboard as board parameter in my .ini results in an error: ID unkown. Neither can I find myboard after running pio boards.

What am I doing wrong?

I’ve never tried putting a board definition in core_dir/boards, have you tried the other 2 places where the documentation says it can be?

Thank you @maxgerhardt for the tip, unfortunately, that didn’t do the trick. I figured out that it’s something specific in the JSON format of my board file that breaks the system. I tried copying the example board setup JSON instead and that does make it show up after running pio board. I copied the exact contents of the already existing adafruit_feather_nrf52832.json as a test and only changed the name to rak4600. After running pio boards again I’m getting the following error:

  Error: Traceback (most recent call last):
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\commands\boards.py", line 34, in cli
    for board in _get_boards(installed):
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\commands\boards.py", line 75, in _get_boards
    return pm.get_installed_boards() if installed else pm.get_all_boards()
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\package\manager\platform.py", line 147, in get_all_boards
    boards = self.get_installed_boards()
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\util.py", line 51, in wrapper
    self.cache[key] = (time.time(), func(*args, **kwargs))
  File "c:\users\dtvan\.platformio\penv\lib\site-packages\platformio\package\manager\platform.py", line 135, in get_installed_boards
    for config in p.get_boards().values():
  File "C:\Users\dtvan\.platformio\platforms\ststm32\platform.py", line 121, in get_boards
    result[key] = self._add_default_debug_tools(result[key])
  File "C:\Users\dtvan\.platformio\platforms\ststm32\platform.py", line 166, in _add_default_debug_tools
    "Missed target configuration for %s" % board.id)
AssertionError: Missed target configuration for rak4600

Any clue what’s going wrong here?

The Adafruit Feather nRF52832 is from the nRF52 platform. It seeems you’ve copied it into the ststm32 platform’s board folder. This is not correct – a nRF52 board definition will miss certain key elements expected by the STM32 platform.

If you are working with a nRF52 board, you should copy it in the nordicnrf52 platform’s board/ folder.

@maxgerhardt, Thank you for the quick reply! I’m trying to add a custom board definition to my local project folder, so in projectname/boards/. I shouldn’t have to place it in the already existing platform’s folder right?

Then you must have platform = ststm32 in the platformio.ini of the project?

What’s the full platformio.ini?

platformio.ini:

[env:rak4600]
platform = nordicnrf52
board = myboard
framework = arduino

Ity shouldn’t matter right? The error was thrown by running pio boards, not by building the project.

For this error to make sense the board must be somehow in the ststm32 platform. Please double check if a copy of it is there, or anywhere else but the project folder.