DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. RAK813 LoRaWAN+BLE+GPS Sensor Node With Eclipse IDE

RAK813 LoRaWAN+BLE+GPS Sensor Node With Eclipse IDE

Check out this post to learn more about building a BLE+LoRaWAN Raspberry Pi RAK831 Gateway to The Things Network.

Erich Styger user avatar by
Erich Styger
·
Apr. 15, 19 · Tutorial
Like (3)
Save
Tweet
Share
8.28K Views

Join the DZone community and get the full member experience.

Join For Free

In the IoT world, it is all about security, connectivity, and low power. LoRaWAN with the Things Network is able to connect devices over several kilometers, and I’m running my gateway for it already (see “Contributing an IoT LoRaWAN Raspberry Pi RAK831 Gateway to The Things Network“). This tutorial is about building a BLE+LoRaWAN+GPS sensor node with GNU tools and Eclipse:

LoRa+BLE with RAK813 and LPC845

LoRa+BLE with RAK813 and LPC845

As far as hardware, I’m using the RAK815 board, which features the RAK813 BLE+LoRaWAN module from RAK Wireless.

I ordered the RAK815 board from AliExpress as a kit (EU868) for $52, which includes everything you need to get started:

RAK815 Kit

RAK815 Kit

The board features the RAK813 module (nRF52832+SX1276), a uBlox GPS module, the SHT31 humidity/temperature sensor, plus the LIS3DH accelerometer.

Setup

For this tutorial, you need:

  • Eclipse IDE: the IDE we are going to use
  • GNU MCU Eclipse Plugins: Eclipse plugins to use the GNU toolchain for ARM
  • GNU toolchain for ARM: the GNU toolchain
  • nRFgo Studio: used to flash the Nordic SoftDevice
  • RAK815 board with RAK813 module (search on AliExpress: “RAK815”)
  • SEGGER J-Link (e.g. SEGGER J-Link Mini with the debug Adapter from Adafruit).

To set up the IDE+toolchain, see this tutorial on how to set up a DIY IDE.

The picture below shows my setup. The RAK815 includes an nRF52832 (ARM Cortex M4F with 512KByte FLASH and 64 KByte RAM). I’m using it in combination with the NXP LPC845-BRK board:

Hardware Setup

Hardware Setup

Because the original projects provided by RAK Wireless are for IAR and Keil only, I have ported them to Eclipse: that way, the free-of-charge IDE and compiler can be used.

The complete project is available on GitHub (see the links at the end of this article).

Below are the porting steps:

Creating a Project

First, clone the repository from https://github.com/RAKWireless/RAK813-BreakBoard

Then, create an empty project for GNU ARM Embedded

Add the Apps, Board, LoRa_Lib, and nRF_Lib folders as linked folders to the project. Add startup code and System files:

Linked Folders

Linked Folders

Files not used have to be ‘excluded from build,’ see “Exclude Source Files from Build in Eclipse“.

In the project settings, use the ARM Cortex-M4 with FPU:

ARM Compiler Settings

ARM Compiler Settings

Add the following folders to the compiler and include settings:

Compiler Includes

Compiler Includes

../../nRF_Lib/components/toolchain/cmsis/include
../../Apps
../../Board
../../Board/lora_board
../../Board/peripherals
../../LoRa_Lib/mac
../../LoRa_Lib/mac/region
../../LoRa_Lib/radio
../../LoRa_Lib/radio/sx1276
../../LoRa_Lib/system
../../LoRa_Lib/system/crypto
../../nRF_Lib/external/fprintf
../../nRF_Lib/external/segger_rtt
../../nRF_Lib/components/boards
../../nRF_Lib/components/device
../../nRF_Lib/components/ble/ble_services/ble_nus
../../nRF_Lib/components/toolchain
../../nRF_Lib/components/softdevice/common
../../nRF_Lib/components/softdevice/s132/headers
../../nRF_Lib/components/softdevice/s132/headers/nrf52
../../nRF_Lib/components/drivers_nrf/clock
../../nRF_Lib/components/drivers_nrf/common
../../nRF_Lib/components/drivers_nrf/gpiote
../../nRF_Lib/components/drivers_nrf/rtc
../../nRF_Lib/components/drivers_nrf/spi_master
../../nRF_Lib/components/drivers_nrf/timer
../../nRF_Lib/components/drivers_nrf/uart
../../nRF_Lib/components/drivers_nrf/twi_master
../../nRF_Lib/components/libraries/balloc
../../nRF_Lib/components/libraries/bsp
../../nRF_Lib/components/libraries/util
../../nRF_Lib/components/libraries/button
../../nRF_Lib/components/libraries/experimental_log
../../nRF_Lib/components/libraries/experimental_memobj
../../nRF_Lib/components/libraries/fds
../../nRF_Lib/components/libraries/fifo
../../nRF_Lib/components/libraries/fstorage
../../nRF_Lib/components/libraries/uart
../../nRF_Lib/components/libraries/experimental_section_vars
../../nRF_Lib/components/drivers_nrf/hal
../../nRF_Lib/components/libraries/strerror
../../nRF_Lib/components/libraries/experimental_log/src
../../nRF_Lib/components/libraries/timer
../../nRF_Lib/components/drivers_nrf/delay
../../nRF_Lib/components/libraries/atomic
../../nRF_Lib/components/libraries/pwr_mgmt
../../nRF_Lib/components/ble/common
../../nRF_Lib/components/libraries/mutex
../../nRF_Lib/components/ble/ble_advertising
../../nRF_Lib/components/drivers_nrf/wdt
../../nRF_Lib/components/ble/nrf_ble_gatt
../../nRF_Lib/components/libraries/mem_manager
../../nRF_Lib/components/ble/ble_db_discovery
../../nRF_Lib/components/ble/peer_manager
../../nRF_Lib/components/libraries/atomic_fifo


Define the following in the compiler Preprocessor-defined symbols:

preprocessor Settings

preprocessor Settings


BOARD_CUSTOM
USE_APP_CONFIG
NRF52
NRF52832_XXAA
NRF52_PAN_74
NRF_SD_BLE_API_VERSION=5
S132
SOFTDEVICE_PRESENT
SWI_DISABLE0
CONFIG_GPIO_AS_PINRESET
REGION_EU868


Specify the linker file:

Linker File

Linker File

Link the Math library and use ‘..’ as library path to find the linker file:

Math Library

Math Library

Use the newlib-nano without syscalls:

Library Options

Library Options

The linker file needs to match the size of the SoftDevice. Using the S123, the start address for the application is 0x23000:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1c000+0x7000, LENGTH = 0x64000-0x7000 
  RAM (rwx) :  ORIGIN = 0x20002a68, LENGTH = 0xd598
}


With this, the application should build just fine

Application Build with Eclipse

Application Build with Eclipse

Debug Connection

The board does not have a standard debug header :-(, so I have to build an adapter:

SWD Debug Header

SWD Debug Header (Source: RAK815 Schematics)

I’m using the J-Link Mini, which has the 10pin mini SWD/JTAG connector. With the Adafruit Debug adapter, I can connect the wires:

Debug Connection

Debug Connection

SoftDevice

As a first step, the SoftDevice needs to be programmed. Use the nRFgo Studio and use the following SoftDevice file:

<repo>/nRF_Lib/components/softdevice/s132/hex/s132_nrf52_5.0.0_softdevice.hex

programming softdevice with nRFgo Studio

programming SoftDevice with nRFgo Studio

Notice that the SoftDevice will use the Region 1 up to 0x23000: This is how we have configured the linker file.

Debug

Now, we can use GDB to download and debug the target. Create a new .launch Debug configuration. Check that it is pointing to the correct Segger Client and GDB server:

Debug Configuration

Debug Configuration

With this, I’m debugging the application:

Debugging LoRaWAN Application

Debugging LoRaWAN Application

It reports the status to the serial console:

console output

console output

Note: The EUI’s and keys are defined in Commissioning.h or can be configured with the smartphone using the BLE connection.

Success.

Summary

It took me a while to build that LoRaWAN+BLE demo application, but now, I have the power of Eclipse to develop it further. The RAK815 board comes with everything I need to start the first prototype for a larger application. With the BLE, I can connect to a smartphone (using a virtual UART), and with the LoRaWAN, I can communicate to the gateways in my area. The board includes an SSD1306 I2C LCD interface, which I plan to add in a next step.

Happy RAKing!

Links:

  • The project discussed in this article: https://github.com/ErichStyger/RAK813-BreakBoard
  • RAK813 GitHub: https://github.com/RAKWireless/RAK813-BreakBoard
  • Getting Started with RAK815 (Arduino): https://www.hackster.io/naresh-krish/getting-started-with-rak815-tracker-module-and-arduino-1c7bc9
Integrated development environment Eclipse

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 3 Ways That You Can Operate Record Beyond DTO [Video]
  • Streamlining Your Workflow With the Jenkins HTTP Request Plugin: A Guide to Replacing CURL in Scripts
  • How To Get Page Source in Selenium Using Python
  • How To Use Terraform to Provision an AWS EC2 Instance

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: