NXP’s Rapid IoT Prototyping Kit is a comprehensive, secure and power-optimized solution designed to accelerate prototype and development of an IoT end node.
Rapid IoT integrates 11 NXP devices (microcontroller, low-power connectivity, sensors, NFC, secure element, power management, interface) in a small form-factor hardware design, and combines it with proven software enablement (drivers, RTOS, middleware, cloud connect) and a web IDE with GUI based programming.
Rapid IoT provides the easiest and fastest path for anyone to take their connected thing idea to a proof-of-concept. -- NXP.com
An adapter board will be available that allows you to easily connect the Rapid IoT to the FMUK66. This RDDRONE-IOT or "HDIB board" (HoverGames Drone IoT Adapter Board) has JST-GH connectors for UART, CAN and debugging. It also has two mikroBUS sockets for connecting all kinds of Click Boards. More information is available on its own page:
Example code to enable MAVLink is available. More information can be found on its own page:
Board which connects the RapidIOT board and the NXPhlite or other Dronecode.org FMU
The RDDRONE-IOT or "HDIB board" (HoverGames Drone IoT Adapter Board) is an experimental adapter board that allows the NXP RAPID-IOT board to connect to the RDDRONE-FMUK66, NXPhlite or another PX4 type FMU using Standard JST GH Connectors. It will accommodate two mikroelectronica CLIK modules, and has both CANBUS and UART connections to the outside world. An NXPhlite DCD-LZ debug port is provided at the bottom of the board which provides SWD debug as well as a UART console port. It will also accept a separate 3V or 5V custom power input ans well as the 6 pin JST-GH power brick input from a PX4-type power module.
The HDIB can also be configured to work with VSCP.org. VSCP stands for Very Simple Control Protocol and is typically implemented on a CAN Based IOT devices. To enable this a 3 pin DC-DC regulator needs to be soldered onto the HDIB board.
The RapidIOT would make for an excellent VSCP node, or bridge between CAN and Thread wireless networking.
The HDIB allows for several use cases combining a drone or rover and IoT, in other words "mobile IoT". Some examples are:
Peripheral to the drone
MAVLINK UART connected sensor (UV Light, Gas, pressure, radiation)
UAVCAN CAN connected generic node reference
LCD display of drone data
configuration settings input
NFC tag reader
Bluetooth BLE peripheral
Thread 802.15.4 IPV6/6LowPan mesh network radio
Controller of the drone
Use SDK to control drone operation
Use drone to get 3D position information for mapping point clouds of data
UV light map, C02 gas, Radiation detector in 3D point cloud resulting in a map or vector to source.
Map a workplace for light and oxygen levels.
Parallel operation / Payload
Ground based device for landing or sensing
Use BLE or Thread or IR
The HDIB is meant to be highly configurable, particularly in terms of power supply or power flow. there are several diodes and optional resistors used to steer power. Please check your particular board to ensure that the components are set correctly.
Communication between the FMU and the Rapid-IoT
When you are not familiar with the Rapid IoT, you can do the from the NXP website. There you can get also the which includes a "Hello World"-Example.
You need the both SDKs "SDK_2.xRapidIoT_MK64F12" and "SDK_2.xRapidIoT_MKW41Z4". Download them and install the SDKs by Drag&Drop into the "Installed SDKs" window in MCUXpresso.
In the "MCUXpresso IDE - Quickstart Panel click on the option "Import SDK example(s)..".
The "SDK Import Wizard" pops up. Here choose your board, in this case the "rapid_iot_k64f" and click on "Next".
In the following window you can define a project name prefix and a project name suffix. In this case the default names are used.In the "Project options" choose UART as SDK Debug Console and check under the "Examples" the "hello_world". Compare with the picture below. Now click on "Next".
In the last window uncheck the Options "Redirect SDK "PRINTF2 to C library "printf" and "Include semihost HardFault handler" and check the option "Redlib: Use floating point version of printf":
Now click on "Finish". The project will be created. This could last a moment. Build your project for the first time by using the "Build"-symbol in the upper left corner or the "Build" button in the "Quickstart Panel. (see Picture) The compiler should run without errors.
We are now ready including the SDK example. Now we have to prepare the project for the MAVLink demo and then include the MAVLink Demo. First we have to activate the UART2 port in the code:
The UART2 Port is not activated jet. So we have to go the the "Peripherals". To do that select "Window" -> "Perspective" -> "Open Perspective" -> "Peripherals" or use the shortcut in the upper right corner.
Go to the Functional Group "BOARD_Init_TERMINAL_UART" and scroll down to the "UART2" Peripheral in the left menu "Peripherals". Check "UART2" and double click on the name if the menu do not open automatically. Rename the "Name" to "UART2" (instead o "UART_1") and control if the "UART baud rate" is 115200.
An error may be displayed in the functional group "BOARD_Init_BATSENS". If so, go to this group and open the menu for ADC0. There the input clock source is missing. Select the "Bus clock - BOARD_Boot_Clock_RUN: 60 MHz" for the ADC.
Now you can Update the Project via the green Button on top. A window will pop up. Click on "OK" to update your project.
Build your project again.
Now, you might get errors.These are due to inconsistent makro names. At the moment there is no better solution than to adjust these makros manually. This must be done according to the following pattern:
Double click on an error in the "Console"
In one file more than one makro could be corrupt. You can identify the errors by the red underscores and the red crosses on the left side.
Change only makros which are marked as errors!
NOTE: Only one makro per line is corrupt. If you want to see which one is incorrect, drive the mouse over the red cross. Then you will be shown which macro is corrupt.
In the picture above the makro GPIO_INITPINS_TOUCH_RST_GPIO_PIN
is corrupt. Change this to GPIO_INITPINS_TOUCH_RST_PIN
.
But the makro GPIO_INITPINS_TOUCH_RST_GPIO
is okay. Leave this makro as it is!
Change every incorrect makro with _GPIO_PIN
at the end to _PIN
-> Delete the GPIO
Change every incorrect makro with _GPIO_PORT
at the end to _PORT
-> Delete the GPIO
Change every incorrect makro with BOARD_INITPINS_KW41_UART_RTS_GPIO
at the end to BOARD_INITPINS_KW41_UART_RTS_PORT
Change every incorrect makro with BOARD_INITPINS_KW41_UART_CTS_GPIO
at the end to BOARD_INITPINS_KW41_UART_CTS_PORT
Change every incorrect makro with _PERIPHERAL
at the end to _PORT
Change every incorrect makro with _CHANNEL
at the end to _PIN
Save the file and build the project again.
Repeat these steps until there are no (new) errors anymore
If you only want to use the example, skip the next subsection and go to the section "Including the MAVLink Demo". If you want to write your own application, go further.
In your source code include the UART-Library as follows: #inlcude "fsl_uart.h"
The configuration of UART2 looks like:
The UART2 has to be initialized first. You can do this as follows:
Creating a MAVLink heartbeat message is possible by using the mavlink_msg_heartbeat_pack()
. Then the heartbeat has to be changed into a message with mavlink_msg_to_send_buffer()
before sending. Sending the heartbeat message could be done by UART_WriteBlocking(
). Check the example below:
With the following code you can receive a message and interpret it as a MAVLink message.
After receiving a heartbeat message can be decoded by using the function mavlink_msg_heartbeat_decode(&message, &heartbeat)
. This function decodes the message
and saves the result in heartbeat
.
As another example we show you how to receive a system status message and print the voltage to the Rapid-IoT display. This works on the same principle:
The same procedure can be used for example receiving GPS or battery status messages. Therefore you have to replace the sys
in the function with gps
or battery
. Check the source code "hg_mavlink_demo.c" in the project for these examples.
Mount the cable for connecting the RDDRONE-IOT "HDIB" adapter board with the FMU using UART2 as shown in the picture below.
The TELEM2 Port on the FMU has to be activated first. You can do this in QGroundControl. Go to the menu "Setup", then "Parameter" and click on "MAVLink". Set the parameters as shown in the picture below. You only have to change the (red) "MAV_1_*"-parameters.
Then change the Telemetry 2 baud rate to "115200 8N1" in the menu "Setup"->"Parameter"->"Serial". See red parameter in the picture below.
A MAVLink demo for the Rapid-IOT is available . The code includes sending and receiving messages via MAVLink using the UART2 port of the RDDRONE-IOT "HDIB" adapter board. The code bases on the "hello_world"-application of the "SDK_2.3.0_RapidIoT_MK64F12"-projects. We work with MCUXpresso.
Download the Repository for the and copy folder "mavlink" to your project. The file "hg_mavlink_demo.c" replaces the "hello_world.c". Delete the "hello_world.c" and copy "hg_mavlink_demo.c" into the "source" folder. Build your project. There should be no error. Now you can flash the code on the Rapid IoT. You can use the "GUI Flash Tool" for this. This can be found in the upper menu bar as a blue symbol.
Use the Jlink debugger as described . The program is now ready. If you want to write your own MAVLink code go further. Else skip this subsection and follow up the Section "Connecting the RDDRONE-IOT "HDIB" adapter board to the FMU" to connect your Rapid IoT device.
Using MAVLink you need the . Download the project and add it as a folder "mavlink" to your project. Then include the common library in your source code as follows: