Developing guide

This guide will provide instructions to install the development environment needed to compile and debug the demo firmware of the Sensor Node Lora. The development system is multiplatform, it supports Windows and Linux. This guide is written using Windows. The main steps are:

  • Install Kinetis Design Studio 3.2.0, upgrade it and install KSDK 1.3.0
  • Import build & debug the source project

Hardware required:

  • Sensor Node Lora with battery or Mini-USB cable
  • if you don’t use Mini-USB cable Segger it is required a J-Link (Segger website) with SWD debug interface.
  • PC with Windows or Linux

Install & Update Kinetis Design Studio

  1. First up, register at the NXP website registration form
  2. Download the IDE from this page. Clicking on Download button.
_images/download_kinetis_0.jpg
  1. Click on Downloads for Kinetis Design Studio for Microsoft Windows.
_images/download_kinetis_1.jpg
  1. Agree the terms and download the file Installer: Kinetis Design Studio 3.2.0 Installer for Windows.
_images/download_kinetis_3.jpg
  1. Next, launch the downloaded file kinetis-design-studio_3.2.0.exe following all the default options.
  2. Launch the KDS and select a directory for the workspace. Our project will be imported in this folder. In this guide we used this path:
_images/kds_workspace.jpg
  1. At this point, if you want to modify the project using processor expert it is required to install also the package KSDK 1.3.0 in order to be compatible with the project. You can find this package on KINETIS-SDK page. Select Download button from Kinetis SDK.
_images/download_kinetis_KSDK_1.jpg
  1. Select KSDK v1.3.0 Mainline releases
_images/download_kinetis_KSDK_2.jpg
  1. Agree the terms and then download Kinetis SDK 1.3.0 Mainline - Windows.exe
_images/download_kinetis_KSDK_3.jpg
  1. Install it following all the default options, it will be installed into C:\Freescale\KSDK_1.3.0
  2. Now launch KDS 3.2.0
  3. Select Help -> Install New Software
  4. Click on Add... button
  5. Then click on Archive button
  6. Now select from C:\Freescale\KSDK_1.3.0\tools\eclipse_update the file KSDK_1.3.0_Eclipse_Update
  7. Select the package KSDK 1.3.0 Eclipse Update
  8. Continue with the wizard. Accept the license agreement during the installation process.
  9. Restart KDS

Now you are ready to import the project in your KDS.

Import Project

  1. Download the project 1083_SW_BAEVTSS002_REL5b.zip.
  2. Then go to File->Import and select Existing Projects into Workspace.
_images/kds_archive.jpg
  1. Browse to the zip file containing the project and select the project.
_images/import_lora.jpg
  1. Press on Finish. Now you are ready to build and debug it. There are two ways to debug the board, the easiest is debug it via USB.

Build & Debug via USB

With the Mini-USB connector you are able to use OpenOCD inteface. It is necessary to install the mbed serial port driver.

  1. Go to the mbed website
  2. Download the lastest mbed serial port driver, it is named as mbedWinSerial.
  3. Install the driver.
  4. After the installation, connect the lora-node board to the PC via the CN2 connector.
_images/board_usb.jpg
  1. Turn On the board switching the SW1 as in figure.
_images/board_usb_on.jpg
  1. Windows will recognize it as a MBED mass storage device.
_images/mbed_open.jpg
  1. On the KDS from the menu click on Project->Build All, to compile the entire project.
  2. Then click on Run->Debug Confiuration->Lora_Debug_OpenOCD.
_images/kds_debug_openocd.jpg
  1. Clicking on Debug button the debug will start entering on the first line code of the main() function.
_images/eclipse_debug.jpg

Warning

  • Due some problem with KDS, sometimes you have to launch the debug twice before the KDS will run the debug correctly.
  • During the debug session the sleeping mode doesn’t work.

Build & Debug via SWD

  1. Go to Project->Build All, to compile the entire project. In order to debug it connect the J-Link to the connector CN4.

Note

Connector CN4 is not fitted on the lora-node board. It is a connector SMD MALE STRIP 2x5 P1.27mm. You have to fit it in order to debug the board via SWD.

  1. The used debug interface is SWD. Then turn on the board switching the SW1.
_images/board_jlink.jpg
  1. Always on the KDS click on Run->Debug Confiuration->GDB Segger J-Link Debug.
_images/kds_debug.jpg
  1. Clicking on Debug button the debug will start entering on the first line code of the main() function. During the debug session the sleeping mode doesn’t work.

Reset Factory

From the release 1.4 you can reset the RN module throught the menu. Follow the next steps:

  1. Download the file Lora_v15b.bin.zip and unzip it
  2. Connect the board from your PC to the board via micro-USB cable. Open the MBED mass storage.
_images/mbed_open.jpg
  1. Copy the Lora_v15b.bin file into the MBED mass storage
  2. The Green led on the board will flash while the file is programmed into the device flash memory.
  3. Now we have to connect a terminal to the Serial Com. First step, find which number is, going to “Device Manager” and finding the node called “Ports (COM and LPT)”. In this example the number port is 170.
_images/device_manager.jpg
  1. Open a terminal like putty, you can find it here. Launch it and set the properties signed in red in the figures:
_images/putty_session.jpg _images/putty_serial.jpg
  1. Press the Open button. Now reset the board pressing S3.
_images/board_s2_s3.jpg
  1. On the putty console you will see the starting boot text:
BAEVTSS002 firmware version 1.5b
RN2483 1.0.1 Dec 15 2015 09:38:06
  1. Keeping the S2 button pressed you will see after some seconds the text Please release the button S2. Will be displayed a menu like this one:
*** MENU CONFIG RN2483 ***
Enter 0 to print this menu
Enter 1 to see values in DEVEUI and DEVADDR registers
Enter 2 to modify DEVEUI
Enter 3 to modify DEVADDR
Enter 4 to modify APPSKEY
Enter 5 to modify NWKSKEY
Enter 6 to save changes
Enter 7 to Microchip default reset
Enter 8 to Avnet default reset
Enter 9 to exit
  1. From the menu press the key 8 referred to Enter 8 to Avnet default reset. During the reset will be showed:
Starting Avnet default reset, please don't turnoff the board
  1. Wait until will be showed the message success.
  2. Now if you have to set correctly the DEVADDR register, see the paragraph Update firmware in Quick start guide for firmware 1.4 or major

Note

with the sources you can build the firmware 1.5b. You can generate the bin file to copy in the mass storage simpy using the Lora.bin

_images/lorabin.jpg

Processor Expert

The Kinetis software development kit (KSDK) is an extensive suite of robust hardware interface and hardware abstraction layers, peripheral drivers, RTOS abstractions, stacks, and middleware designed to simplify and accelerate application development on Freescale Kinetis MCUs. The addition of Processor Expert technology for software and board configuration provides unmatched ease of use and flexibility. Included in the Kinetis SDK is full source code under a permissive open-source license for all hardware abstraction and peripheral driver software. Mainline releases include support for a collection of Kinetis MCUs, whereas standalone releases offer support for one or a few additional Kinetis MCUs only. For details read KSDK page.