Getting started with the X-CUBE-SFXS2LP1 software expansion for STM32Cube
Introduction
The X-CUBE-SFXS2LP1 expansion software package for STM32Cube runs on the STM32 and includes the drivers for S2-LP
and the library for the Sigfox™ proprietary protocol.
This software together with the suggested combination of STM32 and S2-LP device can be used, for example, to develop
applications for smart home/building and smart cities, agriculture, parking, lighting, etc.
The expansion is built on STM32Cube software technology to ease portability across dif
The software comes with a sample implementation of the drivers running on the X-NUCLEO-S2868A2 and X-NUCLEO-
S2915A1 expansion boards connected to a NUCLEO-L073RZ, NUCLEO-L152RE or NUCLEO-L476RG development board.
RELATED LINKS
Visit the STM32Cube ecosystem web page on www.st.com for further information
ferent STM32 microcontrollers.
UM2497 - Rev 2 - July 2020
For further information contact your local STMicroelectronics sales of
fice.
www.st.com
1Acronyms and abbreviations
Table 1. List of acronyms
AcronymDescription
BSPBoard support package
CLICommand line interface
CMSIS
GUIGraphical user interface
HALHardware abstraction layer
IDUnique device ID
PACPort authorization code
SPISerial peripheral interface
Cortex® microcontroller software interface standard
UM2497
Acronyms and abbreviations
UM2497 - Rev 2
page 2/21
X-CUBE-SFXS2LP1 software expansion for STM32Cube
2X-CUBE-SFXS2LP1 software expansion for STM32Cube
2.1Overview
The X-CUBE-SFXS2LP1 software package key features are:
Complete software to build applications using Sigfox™ long range wireless area network running on the S2-
•
LP high performance ultra-low power RF transceiver
•S2-LP Sigfox™ library with a complete set of APIs to develop embedded applications
•Compatible with the STSW-S2LP-SFX-DK graphical user interface (GUI) to register end-device to Sigfox™
network and get ID (Unique Device ID)/PAC (Port Authorization code) /Key from the pool assigned to ST
devices
•Sigfox proprietary protocol with Monarch feature
•GUI PC application available as interactive interface to transmit messages to the Sigfox™ network
•Sample implementation available on the X-NUCLEO-S2868A2 and X-NUCLEO-S2915A1 expansion boards
connected to a NUCLEO-L073RZ, NUCLEO-L152RE or NUCLEO-L476RG development board
•ID/PAC/Key stored in internal MCU flash or external EEPROM
•Easy portability across different MCU families, thanks to STM32Cube
•Free, user-friendly license terms
UM2497
2.2Architecture
The software is based on the STM32CubeHAL hardware abstraction layer for the STM32 microcontroller and
extends STM32Cube by providing the middleware library for the Sigfox application using the S2-LP expansion
board and ready-to-use samples to show this library usage.
The software layers used by the application software to access and use the board are:
•STM32Cube HAL layer: provides a generic, multi-instance set of simple APIs (application programming
interfaces) to interact with the upper layers (application, libraries and stacks). It is composed of generic and
extension APIs. It is directly built around a generic architecture and allows the layers that are built upon,
such as the middleware layer
hardware configuration for a given Microcontroller Unit (MCU). This structure improves the library code
reusability and guarantees easy portability across devices.
•Board support package (BSP) layer: supports the peripherals on the STM32 Nucleo board, except for the
MCU. This limited set of APIs provides a programming interface for certain board specific peripherals (like
the user button, the reset button, etc.) and helps in identifying the specific board version.
•Middleware: includes the Sigfox Libraries in lib(.a) form with a complete set of APIs to develop embedded
applications.
, to implement their functionalities without dependencies on the specific
The software is packaged in the following main folders:
•Documentation: with a compiled HTML file generated from the source code that details the software
•Drivers: contains the HAL drivers, the board specific drivers for each supported board or hardware platform,
•Middlewares: contains the Sigfox library and Sigfox interface for STM32 as well as the libraries for ETSI,
•Projects: provides sample applications for the push button demo and CLI demo.
•Utilities: contains the files to interpret the commands sent via PC using the GUI or any terminal utility. It also
2.4APIs
UM2497
APIs
components and APIs.
including the on-board components ones and the CMSIS layer which is a vendor-independent hardware
abstraction layer for the ARM Cortex-M processor series.
ARIB,FCC and ALL specification.
In the push button demo, the Sigfox message is transmitted by simply pressing the user button on the
STM32 Nucleo boards. The message is shown on the Sigfox web application.
In the CLI demo, CLI (command line interface) mode provides the connectivity with Sigfox GUI. The Sigfox
message is transmitted by clicking “Tx” in the GUI. The projects are provided for the NUCLEO-L073RZ,
NUCLEO-L152RE
Workbench for ARM, RealView Microcontroller Development Kit (MDK-ARM) and System Workbench for
STM32 (SW4STM32)).
contains the Sigfox GUI.
and NUCLEO-L476RG platforms with three development environments (IAR Embedded
Detailed function and parameter descriptions for the user-APIs are compiled in an HTML file in the software
package Documentation folder
.
2.5Sample application description
The Sigfox over S2-LP library features:
•complete set of the APIs to develop the embedded application
•graphical user interface (GUI) PC application to provide an interactive interface to transmit messages to the
Sigfox network
•ready-to-use projects available for IAR, Keil and STM32CubeIDE
•easy portability across different MCU families, thanks to STM32Cube
The user application features:
•initialization of the Sigfox and S2-LP stack
•user functions required for the application
•application handling
2.5.1RF_LIB library
The RF_LIB library configures and implements the S2-LP modulation scheme.
The library drives the S2-LP according to the Sigfox modulation protocol:
•
DBPSK for uplink (14 dBm at 100 bps for RCZ1/3, 22 dBm at 600 bps for RCZ2/4)
•2GFSK, BT=1 for downlink
The channel frequency, data rate and other relevant parameters depend on the applicable radio control zone
(RCZ).
UM2497 - Rev 2
page 5/21
UM2497
Sample application description
The library is compiled for devices equipped with certain ARM® Cortex® cores. Separate versions are supplied in
the following folders:
User applications call generic APIs not linked to any specific hardware whereas the RF_LIB library calls low level
APIs to provide the necessary hardware platform support.
2.5.2MCU_API module
The framework can be easily ported to another board equipped with a microprocessor of the same type but with a
dif
ferent pinout by simply re-implementing the MCU_API module.
Table 2. MCU_API module details
NameArgumentDescription
size: the number of bytes to be allocated
MCU_API_malloc
MCU_API_freepointer: pointer to the memory of free upFree memory allocated to the library.
MCU_API_get_voltage_temperature
MCU_API_delaydelay_ms: number of ms to waitBlocking function for delay_ms milliseconds.
MCU_API_aes_128_cbc_encrypt
MCU_API_get_nv_mem
MCU_API_set_nv_mem
MCU_API_timer_start_carrier_sense
pointer: pointer to the new allocated block of
memory
voltage_idle: pointer to the variable where voltage
in idle should be stored
voltage_tx: pointer to the variable where voltage
in TX should be stored
temperature: pointer to the variable where
temperature should be stored
encrypted_data: pointer to the destination buffer
where the encrypted data must be stored
data_to_encrypt: pointer to the source buf
where the data to encrypt are stored
data_len: length of the data buffer to encrypt
read_data: pointer to the array where the NVM
content should be stored.
data_to_write: pointer to the array containing the
data to be stored in the NVM.
timer_duration_ms: the total duration of the timer
in milliseconds. This function starts a timer without
blocking the application.
fer
Allocates memory for library usage
(memory usage = size in bytes) This
function is called only once at the Sigfox
library opening.
Gets voltage and temperature for out of
band frames. The value must respect the
units for backend compatibility
This function is in charge of encrypting the
data transmitted by the Sigfox library.
This function is used to read data from the
NVM used by the Sigfox library
This function is used to write data to the
NVM used by the Sigfox library
This timer is used for the carrier sense (in
RCZ3 only).
.
.
.
UM2497 - Rev 2
page 6/21
Sample application description
NameArgumentDescription
MCU_API_timer_start
MCU_API_timer_stopNone
MCU_API_timer_stop_carrier_senseNone
MCU_API_timer_wait_for_endNone
MCU_API_report_test_result
MCU_API_get_versionpointer to the array variable and sizeThis function gets current version
This function starts a timer without blocking
the application. Y
let the μC enter low power mode.
This function stops the timer started by the
MCU_API_timer_start.
This function stops the timer started by the
MCU_API_timer_start_carrier_sense
Blocking function to wait for interrupt
indicating timer elapsed. This function is
used only for the 20 seconds in downlink.
Reports the result of RX test for each valid
message received/validated by the library
Gets the device ID
Gets the device initial PAC
Performs a raw SPI operation with the
passed input buffer and stores the returned
SPI bytes in the output buffer.
Enables or disables the external interrupt on
the μC side. The interrupt must be set on
the rising or falling edge of the input signal
according to the trigger_flag. The pin
number represents the S2-LP GPIO
number
.
Instructs the firmware to use the low power
when blocking procedures are called.
The μC waits for an interrupt function. This
can be a null implementation or can activate
μC low power mode.
Sets the system clock. This function is used
after waking up from low power
Enables the encryption payload flag.
ou should use an RTC to
.
UM2497
.
UM2497 - Rev 2
This module has to call the callbacks listed below and implemented by the ST Sigfox library.
page 7/21
Loading...
+ 14 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.