The RAK8212 is a versatile developer board ideally suited for prototyping IoT use-cases. LTE NB-IoT is one option to send telemetry data to a IoT platform or receive configuration data and firmware updates over the air.
The board already includes a lot of sensors to play around with and cover a lot of typical IoT use-cases:
- Location (GPS)
- Temperature, Pressure, Relative Humidity (Bosch BME280)
- Ambient light (TI OPT3001)
- Accelerometer (ST LIS3DH)
- Magnetic field (ST LIS2MDL)
The NB-IoT connectivity is provided by the Quectel BG96 module.
In the following sections I try to help you (the reader) to get started with setting up Espruino on a RAK8212 module on a Windows PC.
Wiring up the J-Link Adapter
For initial flashing of the Espruino firmware you need a J-Link Adapter. This adapter has to support the Serial Wire Debug (SWD) interface.
Check the documentation of your J-Link adapter for the SWD connector pinout.
For Segger J-Link adapters, one source of information could be here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description/
Connect the connector pins of the J-Link adapter with the related pin headers on the RAK8212 adapter board.
Connector SWD pinout | RAK8212 header pin label VTref | VDD SWDIO | SWDIO SWCLK | SWCLK RESET | RESET GND | GND
When finished, attach J-Link adapter to the Windows PC using the USB cable.
Don’t worry, you don’t need to have this pricey J-Link adapter shown in the picture. A J-Link Edu Mini for about €20 will do the job, too.
Download the Espruino firmware
You can download the Espruino firmware for the RAK8212 module on Espruino’s download page.
Under “Find a binary” choose the board “iTracker RAK8212”.
Download cutting edge build espruino_1v99_RAK8212.hex
Make sure to “save the link as” a file, and not get the firmware displayed in the browser and saving it from the browser.
Flash the Espruino firmware
Download, install and start Nordic nRFgo Studio on the Windows PC.
Then we select “nRF5x programing” in the Device Manager panel, and the following UI will be shown in front of us:
Press button “Erase all” to erase the firmware which had been programmed into the RAK8212 module before.
Select notepad tab “Program Application”, locate the file espruino_1v99_RAK8212.hex and press button “Program”. Flashing the firmware may take some minutes.
In the “Log” section on the bottom of the nRFgo Studio application, there should now be a statement like “Application espruino_1v99_RAK8212.hex programmed successfully.”
Set up serial terminal session
As you have plugged in the USB connector cable of the RAK8212 adapter board into your PC, a COM port should have been assigned to the serial interface. You can find out the assigned COM port using the Windows Device Manager. In my case, the COM port is COM19.
Setup a serial connection to this COM port using the terminal application “putty”.
Enter the COM port name as “Serial line”, 9600 as “Speed” and “Serial” as “Connection type”.
Press the “Open” button to start the serial terminal session.
After pressing the RESET button the the RAK8212 adapter board, you should get an output in the terminal as follows:
You now no longer need the J-Link adapter and can remove it from the RAK8212 adapter board.
Set up Web IDE
Download the Espruino Web IDE for the Chrome browser following the instructions here: https://www.espruino.com/Web+IDE
Run Espruino Web IDE from Chrome’s home screen (or the App Launcher).
Click the orange Connect/Disconnect icon in the Top Left.
You should be asked for the right COM port to use now. If everything goes well, the Web IDE will connect to your RAK8212.