Skip to main content

RAK3244 BastWAN Breakout Board Quick Start Guide

Description

RAK3244 BastWAN puts the RAK4260 module into a Feather compatible format, developed by ElectronicCats. The RAK4260 LPWAN Module used as the core of RAK3244 BastWAN is based on Microchip’s SAM R34 (R34J18B). It is a SiP device integrating a 32-bit ARM Cortex -M0+ MCU with a LoRa Transceiver. It offers full coding support with the Arduino™ IDE.

For more information about the board, check the ElectronicCats RAK3244 BastWAN repository.

Hardware Setup

The BastWAN is a Feather breakout board with everything you need to get started on your project.

warning

Before powering the Feather Board, make sure that you have already connected the included LoRa Antenna. Not doing so might damage the board.

Software Setup

Burning a Bootloader

RAK3244 BastWAN board comes with a pre-flashed bootloader upon purchase. However, if it is necessary to replace the bootloader, you can burn the bootloader-bast-wan-v3.4.0.bin with Jlink as demonstrated below:

Figure 5736: Burning the bootloader

You can also flash the bootloader by using the RAKDAP1 Flash and Debug Tool. The guide on how to connect RAK3244 to RAKDAP1 can be found on SWD Programming Interface section of RAK3244 datasheet.

After ensuring the correct wiring connection, you can now flash the bootloader using the pyocd command. If you do not have pyocd installed on your system, check the pyocd installation guide.

pyocd flash -t atsaml21j18a bootloader-bast-wan-v3.4.0.bin

Once the command is executed, the bootloader should be flashed successfully. You can now connect the RAK3244 BastWan to your PC.

Setting up The Things Network (TTN)

In this section, The Things Network (TTN) and the procedure to set up the platform to connect with RAK3244 BastWAN are explained.

Figure 5737: RAK3244 BastWAN in the context of the TTN

As shown in Figure 2, the RAK3244 BastWAN is one of the devices located on the left side. In the context of an IoT solution, the objective is to deploy devices to sense the relevant process variables and transmit the data to the backend servers located in the cloud. The data will be processed and integrated as part of a larger solution that could generate efficiency, traceability, predictability capacity among others.

The RAK3244 BastWAN can be part of this ecosystem, and the objective of this section is to demonstrate how simple to send data to the TTN using the LoRaWAN protocol. To achieve this, the RAK3244 BastWAN must be located inside the coverage of a LoRaWAN gateway.

NOTE

The device name used for the setup is "RAK4260" since it is the core of RAK3244 BastWAN. You can designate any device name you want on your setup.

Sign up and Login

If you don't have an account yet, head on to the TTN website and create one. Once done, log in to your account and go to the Console.

Figure 5738: The Things Network Home Page
Figure 5739: TTN Console Page

Create a New Application

  1. Choose APPLICATIONS.
Figure 5740: Application Section
  1. Click the “add application” button.
Figure 5741: Adding an Application
  • Here are the things that you should take note of in adding an application:

    • Application ID - this will be the unique ID of your application in the Network. Note that the characters should be in lower case, no spaces are allowed.
    • Description - this is a concise human-readable description of your application.
    • Application EUI - this will be generated automatically by The Things Network for convenience.
    • Handler Registration - handler you want to register this application to.
  1. After you fill in the necessary information, press the "Add application" button at the bottom of the page. If you see a similar page as shown in Figure 8, then you have successfully registered your application.
Figure 5742: Application Overview
Register a New Device
  1. Scroll down until you see the Devices section. Or, you can click the "Devices" button at the top.
Figure 5743: Register a New Device
  1. Then, register a new device by clicking on the "register devices".
Figure 5744: Add your Device

In this form, the device ID must be unique for the application and must be completed with lower case, alphanumeric characters. The rest of the parameters in the form are very important for the LoRaWAN protocol:

  • Device EUI
  • Application Key
  • Application EUI

The TTN platform can generate these parameters randomly by leaving those fields empty, or you can enter already existing values.

  1. Press the “Register” button at the bottom of this page to finish the process.
Figure 5745: Device Overview

Now that the Device EUI, Application EUI, and Application Key are defined, you can now proceed with the setup of RAK3244 BastWAN LoRa configurations.

Using Arduino IDE to Modify and Flash Firmware

In this section, you will be introduced on how to use the RAK3244 BastWAN with Arduino™ IDE.

BSP Installation

  1. After successful flashing of the bootloader, the BSP library should be installed. To add board support for the RAK3244 BastWAN, start Arduino IDE and open the Preferences window by navigating through File > Preferences. Now, copy and paste the following URL into the 'Additional Boards Manager URLs' input field: https://electroniccats.github.io/Arduino_Boards_Index/package_electroniccats_index.json. Then, press the "OK" button.
Figure 5746: Arduino additional board support
NOTE

If there is already an existing URL on the textbox, click the button at the right end of the field. This will open an editing window, allowing you to paste the above URL onto a new line as demonstrated in Figure 12.

Figure 5747: Alternative method for additional board support
  1. Open the "Boards Manager" by navigating through Tools > Board > Boards Manager.
Figure 5748: Arduino boards manager
  1. Look for Electronic Cats SAMD Boards in the Boards Manager search bar. Click Install for the Electronic Cats SAMD Boards, and wait for the installation to finish before closing the window.
Figure 5749: Installing Electronic Cats SAMD Boards
  1. RAK3244 BastWAN should now be on the list of Boards by navigating through Tools > Board > Electronic Cats SAMD(L)(C) Core for Arduino.
Figure 5750: RAK3244 BastWAN available in Boards list

LoRaWAN Library Installation

RAK3244 BastWAN board uses the Beelan-LoRaWAN library, which supports LoRaWAN Class A and Class C implementations operating in EU-868, AS-923, US-915, and AU-915 bands. You can recognize this library as the <lorawan.h> on the sample code.

In order for the sample code to work, the Beelan-LoRaWAN library must be installed. To do this, navigate to Tools > Manage Libraries on Arduino IDE. Then search for Beelan LoraWAN and install the latest version of the library. The window indicates if the library is installed, as shown in Figure 15.

Figure 5751: Beelan LoRaWAN library installed

Visit the Beelan-LoRaWAN official GitHub repository for more information.

First Test

For a quick test, a sample source code is provided for a LoRaWAN Class A node with OTAA support. Download the source code and open it with Arduino IDE.

The following sections will demonstrate how to modify LoRaWAN parameters to establish a connection with The Things Network (TTN).

Modifying LoRaWAN Parameters

For the RAK3244 BastWAN to successfully connect to a LoRaWAN Platform, several parameters must be properly configured. Not doing so will result in connection failure.

The most volatile parameters on LoRaWAN configuration are the Device EUI, Application EUI, and Application Keys. These data must match with the ones on The Thing Network (TTN) platform. Copy the EUIs and Keys from the TTN platform and paste them on the sample source code. Figure 17 shows the lines of codes that should be modified:

Figure 5752: Device EUI, Application EUI, and Application Keys

Compiling and Flashing the Firmware

Now that the LoRaWAN parameters are set, you can now run the sample program.

Click the Verify button on the upper left of Arduino IDE to compile the code. Before uploading the sample firmware, make sure that the RAK3244 BastWAN is connected and recognized by your PC. To verify this, there must be an assigned port on the Tools toolbar of Arduino IDE. It should not be grayed out.

Figure 5753: Compilation of sample source code

If everything is well, you can now click the Upload button and the firmware should be flashed to your RAK3244 BastWAN.

Figure 5754: Uploading of sample source code

The RAK3244 BastWAN will try to join the LoRaWAN network server, and if it is successful, it will send a string to verify its presence. You can find more details of the operation by examining the sample source code and opening the serial monitor.

Feel free to experiment with your own and explore the capabilities of RAK3244 BastWAN.