How to use the X-CUBE-SUBG1 for SPIRIT1

If you like it, share it


X-CUBE-SUBG1 – Sub-1 GHz RF communication software expansion for STM32Cube is here, at the end of the page.
Here I explain the way to use the example P2P (point-to-point) that is present in the package X-CUBE-SUBG1.

How to use this example

For do the test we use the NUCLEO-L053R8 and the expansion board X-NUCLEO-IDS01A4 (868 MHz).

How P2P works
In the P2P example, the two node, working in the same way.
If you press the Blue Button on the NUCLEO_1 it send a message to the
If NUCLEO_2 receives the transmission, flashes a LED and send back an ACK.
At this point, on the NUCLEO_1, flashes a LED that means that NUCLEO_2 has
received the message sent before. See the diagram below.


How to use the P2P SW
After downloaded the SW, unzip it where you want but remember to remove the
protection of the directory, see below.


C Compiler – IDE
We want to use KEIL because is free for STM32F0xx and STM32L0xx

NUCLEO board and Working directory
We want to use the NUCLEO-L053R8, the related P2P example is present in this directory:

How to open the project
For open the project double click on the: Project.uvprojx

Test if all is OK
First, for test if all is OK, compile the project.
You must see something like below, this means that all is OK.


Important file for the configurations
The file:
contain the SPIRIT1 parameters, that can be modified by the user according to the
For a deep description see this manual (UM1904)

We are interest on this two define, see below:
#define MY_ADDRESS 0x34

MY_ADDRESS is the address of the transmitter
DESTINATION_ADDRESS is the address of the receiver


The changes that are necessary for configure the two NUCLEO-L053R8
It is clear that we must program the first NUCLEO-L053R8 with this two define:
#define MY_ADDRESS 0x34
and program the second NUCLEO-L053R8 with this two define that are inverted respect the first one:
#define MY_ADDRESS 0x44


Now you are ready to test the P2P communication.

Go on TOP

Extra Informations

Please see the UM1904 manual.

SPIRIT1 packet handler overview

Please see the UM1904 manual. The setup are in the file: spirit1_appli.h
Before on-air transmission, raw data is arranged in a packet structure. The SPIRIT1
offers a highly flexible and fully programmable packet: the structure of the packet, the
number, the type, and the dimension of the fields inside the packet depend on one of
the possible configuration settings.

The setup are in the file spirit1_appli.h at line n.81


A detailed description of the SPIRIT1 embedded packet handler is given in the SPIRIT1 datasheet.
Since the P2P communication requires the destination address of the receiving node, the
P2P demo is based on STack and Basic packet handlers.



User configuration
The file: spirit1_appli.h contain the SPIRIT1 parameters, that can be modified by the
user according to the application.
For a deep description see this manual (UM1904).


For selecting SPIRIT1 expansion board, see below.


Radio configuration parameters are below.


Packet configuration parameters are below.


Setting the address of the nodes are below.


Setting the user defined commands are below.



Go on TOP