Quickstart

Make sure you have the SDK and requisites installed, see SDK Setup for details.

Building, uploading and running ICI applications

To run your first application, this guide will show you how to:

  1. Build and upload the ICI application using an existing example

  2. Run the application

Building and Uploading Using VSCode

The SDK provides a workspace file and setup for compilation and uploading ICI applications in Microsoft Visual Studio Code. To open the SDK in VSCode, open the file RIIM.code-workspace present at the top level of the SDK. To build an ICI application, simply select the file you want to compile in the leftmost EXPLORER window and press SHIFT-CTRL-B. This builds whatever file you have selected and is open in the editor. When building is finished, you are prompted

Enter port (or enter to abort) []:

in the bottom TERMINAL window. Here you enter the port your RIIM module is connected to, for instance COM3 or /dev/ttyUSB0. Or just press ENTER to exit without uploading anything.

VSCode integration

Using VSCode for compilation and upload

Building and Uploading Using Scripts

To build and upload your first ICI application, go to the folder ICI_Applications/My_App and execute Compile_And_Upload.bat (Windows) or Compile_And_Upload.sh (Linux). Execution can be done by double-clicking on the file from the file explorer, or by execution from the command line.

This will take the source files provided in the SDK and create image files that are ready to be uploaded to the modules that are mounted on the boards in the Development Kit.

After the compilation and image generation is finished, you’ll end up with this message:

Output/App_MyApp_Leaf_SB.bin is generated. Do you want to upload it to the module / board now?
Enter your SERIAL port name e.g. /dev/ttyUSB0 and hit ENTER
If you only hit ENTER, you will skip uploading

Enter serial port name:

Here you will have to type in the name of the serial port / COM-port that your board is connected to. See How Do I Find My UART Port on Windows? for details on how to determine which COM port to use. Remember also to type in the whole COM port name, not just the number. For instance, use COM23 instead of 23.

The filenames themselves describes what board the image is to be uploaded to. See Example Structure and Naming Conventions for a description on the naming convention used. In the example above, “App_MyApp_Leaf_SB” means that this image should be uploaded to the Sensor Board.

Enter serial port name: /dev/ttyUSB0
……………
Loading Image
Waiting for Bootloader to initiate transfer...
Start transfer:
End transfer
file upload successful
Waiting for bootloader status..
Bootloader Status: Success


----------------------------------------------
ALL DONE!
----------------------------------------------
Press enter to continue

You need to repeat this compile and upload process for each of the boards in the development kit. Pay attention so that the right ICI application is uploaded on the right board.

When finished, you need to reset the boards you just uploaded the image to. The reset button is located on the side of the board. The modules on your boards are now programmed with the ICI applications that are needed to connect the boards and start your RIIM network. Descriptions of the examples are in the README-files in the Example-directories.

Compile Using MAKE

Note

This requires that you have the MAKE tool installed correctly on your machine. See Installing the MAKE Tool for description on how to install this on Windows.

Makefiles are provided with all examples and the My_App ICI application. To compile your program, first go to the directory at the command line. Then type in make and specify source file name to be compiled like in this example:

make SOURCE_FILE=SRC/App_MyApp_Leaf_SB.c

This will compile the file App_MyApp_Leaf_SB.c located in the SRC directory. You can change this to whatever you like. When compiling, an output similar to this will appear in the command line window:

~/RIIM_SDK/ICI_Applications/My_App$ make SOURCE_FILE=SRC/App_MyApp_Leaf_SB.c
Starting creation of RIIM user application
RIIM user application created. Output file is Output/App_MyApp_Leaf_SB.hex

text           data     bss     dec     hex filename
    64            4       0      68      44 Output/App_MyApp_Leaf_SB.elf
../../Framework/Tools/rc188x_image_generator -t app -p 2 -hw 2 -f Output/App_MyApp_Leaf_SB.hex
RC188x Image Generator
Reading hex file :  Output/App_MyApp_Leaf_SB.hex
Creating image
Creating header
No keyfile specified. No encryption is performed
--------------------------------------------------------------------------
HEADER DUMP:
************
00 02 00 02 00 00 02 00 00 00 23 00 00 00 44 00 dd 35 00 00 37 bc e9 71 3e aa 30 00 00 00 00 00

Decoded:
Platform_ID   :  00 02
Hardware_ID   :  00 02
Hardware_Rev  :  00 00
Image_Type    :  02
Version       :  00 00 00
Start_Page    :  23
Image_Length  :  00 00 00 44
Option        :  00
Nonce         :  dd 35 00 00 37 bc e9 71 3e aa 30
Reserved      :  00 00 00 00 00
--------------------------------------------------------------------------
--------------------------------------------------------------------------
FOOTER DUMP:
************
41 5b 3a 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Decoded:
CRC-32        :  41 5b 3a 01
MAC           :  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
--------------------------------------------------------------------------
Writing binary file :  Output/App_MyApp_Leaf_SB.bin

App_MyApp_LEAF_SB.bin is the compiled image and is now located in the Output directory and is ready to be uploaded to the module.

Upload Using MAKE

The image you just created can now be uploaded to the module via UART. If you are using a Radiocrafts development board, a port called COM* (windows) or /dev/ttyUSB* (Linux) will be available for upload. See How Do I Find My UART Port on Windows? on details on how to determine which COM to use.

Uploading of the image is done using the make tool with the argument uploadImage. If your port isn’t /dev/tyyUSB0, you need to specify port when uploading (for example: make uploadImage PORT=COM3 )

Note

Important: You will need to reset the board after starting the tool to enable the tool to connect to the bootloader and upload the image. Reset should be done when the messages “Can’t connect….” start arriving.

~/dev/RIIM_SDK/ICI_Applications/My_App$ make uploadImage OUTPUT_FILENAME=Output/App_MyApp_Leaf_SB PORT=/dev/ttyUSB0
../../Framework/Tools/rc188x_bootloader_utility load-image -f Output/App_MyApp_Leaf_SB.bin -p /dev/ttyUSB0 -t 60
Cannot connect to Bootloader. Failed attempt  1.0  of  60.0 .
Cannot connect to Bootloader. Failed attempt  2.0  of  60.0 .
Cannot connect to Bootloader. Failed attempt  3.0  of  60.0 .
MODULE INFORMATION
EUI64: 00124B001CBCAAF7
Hardware ID: 0x0002 (Unknown)
Hardware Rev: 0x0002
Platform ID: 0x0002 (Unknown)
Platform Version: v35.9.0
App Version: v255.255.255
Bootloader Version: v3.0.0
Bootloader Variant: 0x02 (IP Mesh)
Lock State: 0xFF (Unlocked)

Loading Image
Waiting for Bootloader to initiate transfer...
Start transfer:
End transfer
file upload successful
Waiting for bootloader status..
Bootloader Status: Success
~/dev/RIIM_SDK/ICI_Applications/My_App$

And finally, start the ICI application by resetting the board you uploaded your image to.

Observing the Output

The ICI application simply starts the module as a node and prints out a greeting + configuration. If you open the UART (COM* / ttyUSB*) in a terminal program using a baudrate of 115200 and reset the board, you should see something like this message when the board is startet (reset):

~/RIIM_SDK/ICI_Applications/My_App$ microcom -s 115200 -p /dev/ttyUSB0 connected to /dev/ttyUSB0
Escape character: Ctrl-\
Type the escape character followed by c to get to the menu or q to quit
Starting RIIM Node
# RIIM node configuration:
# - Application Version : 0xffffffff
# - Hardware ID : 0x0000
# - Hardware Version : 0x0000
# - Platform ID : 0x0002
# - Platform Version : 0x00000923
# - Platform Description : RIIM_NODETYPE_MeshRouter
# - MAC Address : 0xf7aabc1c004b1200
# - PAN ID: 0x9812
# - Node ID: 43767
# - Link-layer address: aaf7
# - Local IPv6 address: fe80:0000:0000:0000:0000:00ff:fe00:aaf7:
# - Global IPv6 address: 4c46:0101:0100:0000:0000:0000:0000:0200:
# - Reset code: 0x00000001

The way forward

Now you are ready to start testing. A nice place to start can be to edit the file App_MyApp_Leaf_SB.c and see that your changes is reflected in the executing code.

Be sure to go to www.radiocrafts.com for the latest SDK, documentation and knowledge.