RAK4600 on PlatformIO

Hello,

I just got my hands on this little module RAK4600.
I also found this blog post about using the PlatformIO for development, and I thought it might be really cool to try it out since I’m rather familiar with PIO tools.
However, the RAK github repo only supports three variants, none of whcih is my RAK4600. So the question is, is there a way to somehow incorporate RAK4600 directly, or should I use one of the three instead, as they might be presumably compatible with RAK4600?

Best regards,

Hello @PeraZver , welcome to the forum.

The RAK4600 is not (officially) a WisBlock Core module, so we did not include it in the guide how to use PlatformIO. And it needs several changes to have the RAK4600 supported in PIO:

These are the steps (assuming you use Windows):

  1. Install the Nordic nRF52 platform in PIO
    You might need to compile a simple project first because some parts of the BSP are only installed when you compile a project.

  2. Create the board support JSON file with the name wiscore_rak4600.json in C:\Users<YOUR_USER_NAME>.platformio\platforms\nordicnrf52\boards with this content:

{
  "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": "WisDuo RAK4600",
    "mcu": "nrf52832",
    "variant": "WisCore_RAK4600_Board",
    "bsp": {
      "name": "adafruit"
    },
    "softdevice": {
      "sd_flags": "-DS132",
      "sd_name": "s132",
      "sd_version": "6.1.1",
      "sd_fwid": "0x00B7"
    },
    "zephyr": {
       "variant": "WisCore_RAK4600_Board"
    }
  },
  "connectivity": [
    "bluetooth"
  ],
  "debug": {
    "jlink_device": "nRF52832_xxAA",
    "svd_path": "nrf52.svd"
  },
  "frameworks": [
    "arduino",
    "zephyr"
  ],
  "name": "RAKwireless WisDuo 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://docs.rakwireless.com/Product-Categories/WisDuo/RAK4600-Evaluation-Board/Overview",
  "vendor": "RAKwireless"
}

  1. Download the folder _** [WisCore_RAK4600_Board](WisCore_RAK4600_Board](RAK-nRF52-Arduino/variants at master · RAKWireless/RAK-nRF52-Arduino · GitHub) and place it in the PIO Packages Framework folder C:\Users<YOUR_USER_NAME>.platformio\packages\framework-arduinoadafruitnrf52\variants

  2. Open adafruit.py in the folder C:\Users<YOUR_USER_NAME>.platformio\platforms\nordicnrf52\builder\frameworks\arduino
    Look for
    if env.subst("$BOARD") != "adafruit_feather_nrf52832":
    and replace it with
    if env.subst("$BOARD") != "adafruit_feather_nrf52832" and env.subst("$BOARD") != "wiscore_rak4600":
    Save the file.

Then you can create a new project in PIO and select the RAK4600:

Hello @beegee , thank you for the lengthy explanation! I did everything you said, and I’m happy to confirm that the build process worked just fine! So thanks for that.

By the way, a couple of days ago, I asked the similar question on PlatformIO forum about introducing a custom board in nordic nrf52 platform but without modifying the core PIO folders. It has been discussed here. It ended up successfully, simply by adding the json manifest and variants source files into the project directory. Maybe you’d want to have it the same way with your RAK products.

I tried doing it with the RAK4600. After some messing around, the build ended up successfully - so again, no modifications of the PIO core directory. I did however modified a couple of things:

  • removed all the adafruit stuff
  • changed the linker script
  • removed unnecessary headers from the variants.cpp

Good to hear you could add it.

One reason why we do not want to add our board to the Adafruit BSP is obviously. Adafruit is a competitor and we want to differentiate ourselfs from them.

hello,
well, you do have Adafruit BSP in your board manifest, if that’s what you mean.
I was saying that my version uses other nordic-arduino framework…

Never tried that.
What is the difference to Adafruit?