This example is born to demonstrate the P2P capability using the S2-LP transceiver and the STprotocol.
This is a basic example from wich is possible implement a loot of application like:
For P2P application we developed two software package, one for TX kit and another one for RX kit.
How to use the P2P example
- Upload on TX kit the TX program and on RX kit the RX program.
- Connect the two kit to your PC an open a terminal emulation (we suggest TeraTerm) using this configuration:
—Baud – 115200
—Data – 8
—Parity – None
—Stop – 1
—Flow – None
- When you press the Blue Button on TX kit you must see the green led (it is on NUCLEO-L053R8 board) on RX kit that change status.
On TX kit, if the RX kit send the ACK you must see the green led (on TX kit) that change status.
On other words, every time you press the Blue Button on TX kit you must see the green led (on TX kit and RX kit) that change status.
Press on Blue Botton on TX kit and the green LEDs go ON (on both kit), press again the Blue Botton and the LEDs go OFF, and so on.
On your PC you must see something like below.
- If you go away with the TX kit, at a certain point the LEDs will no longer change status, this indicating that you are beyond the operating distance of the modules.
Below the distance test on this P2P network.
How to get the SW for this project
Please send us an email and ask us the password for: P2P-S2LP
Please specify also your country and your city, this are only for our personal statistics.
Get the SW clicking here, but remember to ask us the password for open it.
Some extra info concerning software of P2P
All the task in TX and RX mode, are developed for working in Interrupts Mode, in this way we free the STM32L0x do do something extra functions and/or task.
The idea was to automate the TX-RX-ACK process for reduce at the minimum the MCU time usage.
The communication from TX and RX is not encrypted so if you need to use this sw for transfer a sensible data we suggest to use a crypto library.
Inside the project there are a lot of files, some are very interesting to study.
We highlight the file below.
In this file there are the S2-LP registers configuration and the address of TX and RX kits.
If you open the S2_LP.c present in the TX package at lines 187 and 193 there are the address of TX and RX board.
// ADDRESS --------------------------------------------- // TX packet destination field - (RX addr.) tmp = 0xA4; /* reg. PCKT_FLT_GOALS3 (0x42) */ S2LPSpiWriteRegisters(0x42, 1, tmp); // RX packet destination field - (TX addr.) tmp = 0xA5; /* reg. PCKT_FLT_GOALS0 (0x45) */ S2LPSpiWriteRegisters(0x45, 1, tmp);
In the same file (S2_LP.c) in the RX package there are the same setup but the address are inverted, see below (line: 197…200).
// ADDRESS RX/TX tmp = 0xA5; /* reg. PCKT_FLT_GOALS3 (0x42) */ S2LPSpiWriteRegisters(0x42, 1, tmp); tmp = 0xA4; /* reg. PCKT_FLT_GOALS0 (0x45) */ S2LPSpiWriteRegisters(0x45, 1, tmp);
For advise the RX to receive only the TX address there is the configuration below (lines: 187 and 188 in S2_LP.c present in RX software package):
tmp = 0x43; /* reg. PCKT_FLT_OPTIONS (0x40) filter on the addresses specified*/ S2LPSpiWriteRegisters(0x39, 8, tmp);
The configuration for S2-LP registers was generated using the S2-LP DK-GUI
Since (Jan-2018) the S2-LP is a relatively new component, below, we decided to put some images with the main features of the S2-LP.