While the Python script to add WisDuo and WisBlock boards to the PlatformIO BSP's is still working, the problem with the script is that it has to be run every time PlatformIO updates the platforms.
To get around this, I checked the possibilities of PlatformIO to add custom boards to existing platforms, and I found a different solution, inspired by the work of Meshtastic. They are using PlatformIO's features to add (or better add customized) additional boards to the existing platforms.
RAK_PATCH_V2 is the result of my findings.
Instead of adding board descriptions and files to the existing platforms, the boards are added directly in the project folders.
This keeps the added boards active, even if the main platform is updated.
For the RAK11300 and RAK11310 modules with the RP2040 MCU, this method works only with the develop branch of platform-raspberrypi that is using the RP2040 BSP arduino-pico provided by Earl F. Philhower, III
PlatformIO allows to add custom board definition files (*.json) and custom variant folders to the main platform by hosting them in the project folder.
To use this feature, 2 steps are required in the project folder:
- Copy the folder rakwireless into the project folder. This folder contains the WisBlock and WisDuo board definitions and board variant files.
- Add access to these board definitions and variant files in the platformio.ini file of the project.
The folder rakwireless and an example platformio.ini file are provided in the archive RAK_PATCH_V2.zip. Download this archive for the next steps.
Copy the complete folder rakwireless from the RAK_PATCH_V2.zip archive into your project folder. The project folder structure should look like:
- EXAMPLE_PROJECT
- .pio
- .vscode
- include
- lib
- rakwireless
- src
- test
- .platformio.ini
To add these "custom" boards to the project, a few entries are required in the platformio.ini file:
- boards_dir to define the path to the additional boards (only needed for RAK4630/RAK4631, RAK11200 and RAK3112/RAK3312)
- build_src_filter to add the variant cpp files to tbe build path (Only needed for RAK4630/RAK4631)
- build_flags = -I rakwireless/variants/rakxxxxxx to include the variant include files (only needed for RAK4630/RAK4631, RAK11200 and RAK3112/RAK3312)
An example that adds all 4 available Arduino based WisBlock Core modules and WisDuo stamp modules to a project can be found in the platformio.ini file.
To use the WisBlock Core RAK4631 or WisDuo RAK4630 stamp module the platformio.ini file should content the following entries:
[platformio]
boards_dir = rakwireless/boards
; other required definitions
[env:rak4630]
platform = nordicnrf52
board = rak4630
framework = arduino
build_src_filter = ${env.build_src_filter}+<../rakwireless/variants/rak4630>
build_flags =
-I rakwireless/variants/rak4630
; other build flags
lib_deps =
; project library dependencies
; other required environment definitionsTo use the WisBlock Core RAK11200 the platformio.ini file should content the following entries:
[platformio]
boards_dir = rakwireless/boards
; other required definitions
[env:rak11200]
platform = espressif32
board = rak11200
framework = arduino
build_flags =
-I rakwireless/variants/rak11200
; other build flags
lib_deps =
; project library dependencies
; other required environment definitionsTo use the WisBlock Core RAK3312 or WisDuo RAK3112 stamp module the platformio.ini file should content the following entries:
[platformio]
boards_dir = rakwireless/boards
; other required definitions
[env:rak3112]
platform = espressif32
board = RAK3112
framework = arduino
build_flags =
-I rakwireless/variants/RAK3112
; other build flags
lib_deps =
; project library dependencies
; other required environment definitionsThe platfromio.ini example is using the rakwireless_rak11300 board, but adds the WisBlock GPIO definitions in the build_flags.
To add the missing WisBlock GPIO definitions with the WisBlock Core RAK11310 or WisDuo RAK11300 stamp module the platformio.ini file should content the following entries:
[platformio]
boards_dir = rakwireless/boards
; other required definitions
[env:rak11300]
platform = https://github.com/maxgerhardt/platform-raspberrypi
board_build.core = earlephilhower
board = rakwireless_rak11300
framework = arduino
build_flags =
-D ARDUINO_RAKWIRELESS_RAK11300=1
; WisBlock definitions
-I rakwireless/variants/rak11300
-D WB_IO1=6
-D WB_IO2=22
-D WB_IO3=7
-D WB_IO4=28
-D WB_IO5=9
-D WB_IO6=8
-D WB_A0=26
-D WB_A1=27
-D PIN_LED1=23
-D PIN_LED2=24
-D LED_BUILTIN=23
-D LED_CONN=24
-D LED_GREEN=23
-D LED_BLUE=24
; other build flags
lib_deps =
; project library dependencies
; other required environment definitionsTwo examples are available to show the usage of the patch.
The first example WisBlock-LoRaWAN-OTAA is a simple example using the SX126x-Arduino library to establish an OTAA based connection to a LoRaWAN server.
The second example WisBlock-API-V2-Example is based on the WisBlock-API-V2 API, that provides low power coding and an AT command interface to setup the devices.
Both examples work on the RAK4630/RAK4631, RAK11300/RAK11310, RAK3112/RAK3312 and RAK11200 + RAK13300 modules.
A small script that installs or updates RAKwireless WisBlock modules in PlatformIO BSP's
This script does not install the required BSP's (platform and package), it only patches already installed BSP's.
REMARK Tested only on Windows 10 and Ubuntu!
Before you can use the WisBlock Core modules with PlatformIO you need to install the original platforms:
- RAK4631 => install nRF52 platform
After the required platforms are installed, follow the steps as shown in Update
After updating or installing the nRF52, ESP32 or Raspberry Pi RP2040 package do the following steps:
- Ignore the Unknown board ID or variant.h: No such file or directory errors until the following patch has been applied
Unzip the contents of RAK_PATCH.zip into folder RAK_PATCH in your PlatformIO installation folder.
| Paths on different OS: | |
|---|---|
| Windows | %USER%\.platformio\ |
| Linux | ~/.platformio/ |
| MacOS | /Users/{Your_User_id}/.platformio/ |
Install the patch
Open a terminal in the .platformio folder and execute python ./rak_patch.py
Example (Windows 10 terminal):
Example (Linux terminal):
Download the complete package from RAK_PATCH.zip







