< Return to Blog

HOWTO Setting up a RAK3172 Evaluation Board (with STM32WLE5CC) and Chirpstack

This board has a STM32WLE5CC which is based on the RAK3372. We will be following the RAK documentation for running a basic verification to ensure that our device and hotspots are working.
I am assuming you are already running at least one configured Helium hotspot; I am using a few RAK hotspots for this demo.
We will be using the RAK RUI SDK version 4.1.1_273 (as this is the latest right now) using the staging branch in Github.  I am also using Arduino IDE v2.3.2 and installed the RUI BSP as detailed above. Your installed board should look like this:
Let's now download the OTAA sketch from the github repository, but make note that we need to make some changes to these few lines. These need to be replaced to be compatible with the v4.1.1 SDK, so replace them with
if(api.lorawan.nwm.get() != 1) { Serial.printf("Set Node device work mode %s\r\n", api.lorawan.nwm.set() ? "Success" : "Fail"); api.system.reboot(); }
We can now change the defaults in the OTAA sketch, as follows:
#define OTAA_PERIOD (20000) /************************************* LoRaWAN band setting: RAK_REGION_EU433 RAK_REGION_CN470 RAK_REGION_RU864 RAK_REGION_IN865 RAK_REGION_EU868 RAK_REGION_US915 RAK_REGION_AU915 RAK_REGION_KR920 RAK_REGION_AS923 *************************************/ #define OTAA_BAND (RAK_REGION_EU868) #define OTAA_DEVEUI {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x88} #define OTAA_APPEUI {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x0E} #define OTAA_APPKEY {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3E}
For most applications, it is advisable to increase OTAA_PERIOD to around 5 minutes (noting the value here is in milliseconds), so you want to use a figure such as 300000.
Update the OTAA_BAND and since I'm in Asia, I've switched over to RAK_REGION_AS923, making note this matches the antennas on my RAK hotspots.  Make sure to get this right.

Flashing the microcontroller using RAK RUI v4.1.1

You'll need to locate where your compiled sketches are stored and I found mine at /var/folders/vk/cb344xdx2jg29k9z7gw_2l240000gn/T/arduino/sketches/*.
If you have issues, try a few of the options listed here for flashing on MacOS.
Having located my attached device at /dev/cu.usbserial-* I proceeded to run the flashing process with python3.
cd ~/Library/Arduino15/packages/rak_rui/tools/uploader_ymodem/1.0.0 python3 uploader_ymodem.py -f /var/folders/vk/cb344xdx2jg29k9z7gw_2l240000gn/T/arduino/sketches/DEBE29DCA60E85740106AA36AD16A9C3/sketch_mar25a.ino.bin -p /dev/cu.usbserial-21240

Configuring Chirpstack

Start by creating your account at https://console.helium-iot.xyz.
You will need to copy your settings into Chirpstack, including the OTAA_DEVEUIOTAA_APPEUI, (called the JoinEUI in Chirpstack) and OTAA_APPKEY.

Checking the events in Chirpstack

You should start to see LoRaWAN frames in Chirpstack, as well as more important Events, as these contain the uplink data payload (encoded as base64).
Notice the data payload above, and we can decode it to double check:
echo "dGVzdA==" | base64 -d | hexdump -C 00000000 74 65 73 74 |test| 00000004
We have now successfully setup this very basic device, where it is pushing bytes over LoRA, the Helium block chain, into Chirpstack.
However, there is an associated cost and this is in the form of "DC" which need to be loaded into your Chirpstack account.  You can use a credit-card to purchase say US$5 worth of credits to start and you'll get around 100,000 DC.

Troubleshooting join issues

If you continue to have device join issues, refer to the FAQ by disk91, as this has some things you can try, especially with device placement.

Thanks to...

In no particular order, I'd like to thank:
  • Bernd Giesecke for advice on the RAK BSPs and RUI versions
  • Carl Rowan for advice re. python dependency related errors in MacOS
  • Paul (disk91) for speedy support responses.