This S2LP RF API is a low level implementation example of the Sigfox EP library, showing the manuf/rf_api.c
file implementation for the S2LP transceiver from ST-Microelectronics.
[!WARNING]
The resulting radio performances of your device strongly depends on your hardware design (schematic, PCB routing, crystal oscillator placement, good RF practices, etc...). Sigfox certification remains mandatory whatever the software embedded in your device (including the Sigfox End-Point library and its implementation examples).
The table below shows the versions compatibility between this radio example and the Sigfox End-Point library.
S2LP_RF_API | EP_LIB |
---|---|
v3.1 | >= v3.6 |
v3.0 | v3.5 |
v2.0 | v3.5 |
v1.3 | v3.4 |
v1.2 | v3.2 to v3.3 |
v1.1 | v3.2 to v3.3 |
v1.0 | v3.2 to v3.3 |
This radio example inherits all the Sigfox End-Point library flags and can be optimized accordingly.
The LOW_LEVEL_OPEN_CLOSE
flag must be enabled to use this example.
The S2LP RF API is based on the official S2LP driver from ST-Microelectronics. This driver exposes a functional interface to configure the chip registers, which is used to perform the Sigfox uplink modulation and optional downlink reception. It relies on low level functions (called board drivers) which need to be implemented to run on your specific hardware. There are divided in 2 groups:
The templates are located in the src/board
folder.
The best way to embed the S2LP RF API example into your project is to use a Git submodule, in a similar way to the library. The radio driver will be seen as a sub-repository with independant history. It will be much easier to upgrade the radio driver or to switch between versions when necessary, by using the common git pull
and git checkout
commands within the sigfox-ep-rf-api-st-s2lp
folder.
In order to keep the repository clean, you will need to exclude the src/board
folder from build (where the board templates are defined) and implement the functions in another location of your project.
To add the S2LP RF API submodule, go to your project location and run the following commands:
mkdir lib
cd lib/
git submodule add https://github.com/sigfox-tech-radio/sigfox-ep-rf-api-st-s2lp.git
This will clone the S2LP RF API repository. At project level, you can commit the submodule creation with the following commands:
git commit --message "Add Sigfox S2LP RF API submodule."
git push
With the submodule, you can easily:
cd lib/sigfox-ep-rf-api-st-s2lp/
git pull
git checkout master
cd lib/sigfox-ep-rf-api-st-s2lp/
git pull
git checkout <tag>
You can download or clone any release of the S2LP RF API example and copy all files into your project.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-rf-api-st-s2lp.git
You can download or clone any release of the S2LP RF API example and copy all files into your project. If you do not plan to change your compilation flags in the future, you can perform a precompilation step before copying the file in your project. The precompilation will remove all preprocessor directives according to your flags selection, in order to produce a more readable code. Then you can copy the new files into your project.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-rf-api-st-s2lp.git
To perform the precompilation, you have to install cmake
and unifdef
tools, and run the following commands:
cd sigfox-ep-rf-api-st-s2lp/
mkdir build
cd build/
sigfox_ep_flags.h
file:cmake -DSIGFOX_EP_LIB_DIR=<sigfox-ep-lib path> \
-DUSE_SIGFOX_EP_FLAGS_H=ON ..
make precompil_s2lp_rf_api
cmake -DSIGFOX_EP_LIB_DIR=<sigfox-ep-lib path> \
-DUSE_SIGFOX_EP_FLAGS_H=OFF \
-DRC1_ZONE=ON \
-DRC2_ZONE=ON \
-DRC3C_ZONE=ON \
-DRC3D_ZONE=ON \
-DRC4_ZONE=ON \
-DRC5_ZONE=ON \
-DRC6_ZONE=ON \
-DRC7_ZONE=ON \
-DAPPLICATION_MESSAGES=ON \
-DCONTROL_KEEP_ALIVE_MESSAGE=ON \
-DBIDIRECTIONAL=ON \
-DASYNCHRONOUS=ON \
-DLOW_LEVEL_OPEN_CLOSE=ON \
-DREGULATORY=ON \
-DLATENCY_COMPENSATION=ON \
-DSINGLE_FRAME=ON \
-DUL_BIT_RATE_BPS=OFF \
-DTX_POWER_DBM_EIRP=OFF \
-DT_IFU_MS=OFF \
-DT_CONF_MS=OFF \
-DUL_PAYLOAD_SIZE=OFF \
-DCRC_HW=OFF \
-DMESSAGE_COUNTER_ROLLOVER=OFF \
-DPARAMETERS_CHECK=ON \
-DCERTIFICATION=ON \
-DPUBLIC_KEY_CAPABLE=ON \
-DVERBOSE=ON \
-DERROR_CODES=ON \
-DERROR_STACK=12 ..
make precompil_s2lp_rf_api
The new files will be generated in the build/precompil
folder.
You can also download or clone any release of the S2LP RF API example and build a static library.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-rf-api-st-s2lp.git
To build a static library, you have to install cmake
tool and run the following commands:
cd sigfox-ep-rf-api-st-s2lp/
mkdir build
cd build/
sigfox_ep_flags.h
file:cmake -DSIGFOX_EP_LIB_DIR=<sigfox-ep-lib path> \
-DUSE_SIGFOX_EP_FLAGS_H=ON ..
make s2lp_rf_api
cmake -DSIGFOX_EP_LIB_DIR=<sigfox-ep-lib path> \
-DUSE_SIGFOX_EP_FLAGS_H=OFF \
-DRC1_ZONE=ON \
-DRC2_ZONE=ON \
-DRC3C_ZONE=ON \
-DRC3D_ZONE=ON \
-DRC4_ZONE=ON \
-DRC5_ZONE=ON \
-DRC6_ZONE=ON \
-DRC7_ZONE=ON \
-DAPPLICATION_MESSAGES=ON \
-DCONTROL_KEEP_ALIVE_MESSAGE=ON \
-DBIDIRECTIONAL=ON \
-DASYNCHRONOUS=ON \
-DLOW_LEVEL_OPEN_CLOSE=ON \
-DREGULATORY=ON \
-DLATENCY_COMPENSATION=ON \
-DSINGLE_FRAME=ON \
-DPARAMETERS_CHECK=ON \
-DCERTIFICATION=ON \
-DPUBLIC_KEY_CAPABLE=ON \
-DVERBOSE=ON \
-DCRC_HW=OFF \
-DERROR_CODES=ON \
-DUL_BIT_RATE_BPS=OFF \
-DT_IFU_MS=OFF \
-DT_CONF_MS=OFF \
-DUL_PAYLOAD_SIZE=OFF \
-DMESSAGE_COUNTER_ROLLOVER=OFF \
-DERROR_STACK=12 ..
make s2lp_rf_api
The archive will be generated in the build/lib
folder.