Dev Support for Arduino Edge Control

Hi,

I’m working with the Arduino Pro Edge Control board, and all work has been done using Arduino IDE 2.0. I would like to make the switch to PlatformIO out of preference, however I haven’t been able to find anything to indicate whether the board is supported or not, or if there is somehow a roundabout way of getting it done.

Any help, suggestions, or comments are welcome! Cheers!

Per https://docs.arduino.cc/hardware/edge-control this is a carrier board that can accept any MKR board but still its own nRF52840 process on-board. The Arduino core ArduinoCore-mbed/variants at master · arduino/ArduinoCore-mbed · GitHub supports it as EDGE_CONTROL.

PlatformIO-wise, the board belongs to platform-nordicnrf52/boards at develop · platformio/platform-nordicnrf52 · GitHub family wise, but no board definition has been created yet. I’ve tracked this now in Add support for Edge Control board · Issue #154 · platformio/platform-nordicnrf52 · GitHub.

Technically you should however be able to create a new board definition just like I’ve done in Add Xiao nRF52840 (Sense) board support by maxgerhardt · Pull Request #151 · platformio/platform-nordicnrf52 · GitHub and changeup the needed options variant to EDGE_CONTROL et cetara. I will have a look at this later.

Thanks for the suggestion. I went ahead and created a new board definition using that of the Nano 33 BLE (due to it also being part of Mbed Core) and relying on ArduinoCore-mbed/boards.txt at master · arduino/ArduinoCore-mbed · GitHub to obtain the necessary information to properly update it.

My instance of PlatformIO recognizes the board now, however whenever a new project is created using the Edge Control as the target board, the include paths found within the generated c_cpp_properties.json file point to USER/.platformio/packages/framework-arduinonordicnrf5/cores/arduino/, which is causing errors. I’m not sure how to have PlatformIO generate the proper include paths, as I suspect it should be USER/.platformio/packages/framework-arduino-mbed/cores/arduino/.

Thanks for your help in this by the way :slight_smile:

Cheers.

Make sure arduino is the core, not nRF5 (Add Xiao nRF52840 (Sense) board support by maxgerhardt · Pull Request #151 · platformio/platform-nordicnrf52 · GitHub).

Yes, I’ve made sure the core is arduino. The edge_control.json board definition is found within USER/.platformio/platforms/nordicnrf52/boards/ directory.

Here is the full definition of the board:

{
    "build": {
      "arduino": {
        "ldscript": "linker_script.ld"
      },
      "core": "arduino",
      "cpu": "cortex-m4",
      "extra_flags": "-DARDUINO_EDGE_CONTROL -DARDUINO_ARCH_NRF52840",
      "f_cpu": "64000000L",
      "hwids": [
        [
          "0x2341",
          "0x005d"
        ],
        [
          "0x2341",
          "0x805d"
        ]
      ],
      "mcu": "nrf52840",
      "variant": "EDGE_CONTROL"
    },
    "connectivity": [
      "bluetooth"
    ],
    "debug": {
      "jlink_device": "nRF52840_xxAA",
      "openocd_target": "nrf52.cfg",
      "svd_path": "nrf52840.svd"
    },
    "frameworks": [
      "arduino"
    ],
    "name": "Arduino Edge Control",
    "upload": {
      "maximum_ram_size": 262144,
      "maximum_size": 983040,
      "protocol": "sam-ba",
      "protocols": [
        "jlink",
        "nrfjprog",
        "nrfutil",
        "cmsis-dap",
        "sam-ba",
        "blackmagic"
      ],
      "use_1200bps_touch": true,
      "require_upload_port": true,
      "wait_for_upload_port": true
    },
    "url": "https://docs.arduino.cc/hardware/edge-control",
    "vendor": "Arduino"
  }

Meh okay there’s an architectural problem because the platform.py is hardcoded to detect some boards as using the ArduinoCore-mbed and others not

a platform-nordicnrf52 fork is necessary. I’ll try something…

Yeah, a tiny patch fixes that.

You can just use

[env:edge_control]
platform = https://github.com/maxgerhardt/platform-nordicnrf52.git#patch-1
board = edge_control
framework = arduino

and delete any local board/ folders in your project folder. Your board JSON file was already exactly correct in regards to compiling.

Can’t test uploading due to no board.

Edit: There’s also a PR open (Add Arduino Edge Control Board support by maxgerhardt · Pull Request #155 · platformio/platform-nordicnrf52 · GitHub).

Wanted to provide an update.

I went ahead and downloaded the files in your fork and replaced the files found in USER/.platformio/platforms/nordicnrf52/ with them. However, the include paths in the generated c_cpp_properties.json file do not reflect pointing to the framework-arduino-mbed package. I was receiving an Error: unknown board ID 'edge_control when I had set the platform to the GitHub repo, but was fixed by changing it back to nordicnrf52.

I’m not sure if I was supposed to have done the above, but it seemed to have made the most sense for me to try and verify whether it would at least upload.

Also, much thanks for your efforts towards this.

The edge_control board file is there and that should have worked fine.

Can you remove all nordicnrf52* folders in .platformio/platforms and use the hplatformio.ini posted above? CI passes and i’ve tested compilation locally.

Max,

Thanks for all the help. Followed your suggestion, and I can now compile code with success. I’ll report back regarding uploading to the board as soon as I can, if you’d like.

Edit: Wanted to follow-up with this and say that code compiles and successfully uploads to the Edge Control board.