
-18-
v7.0
Initialization
6. Initialization
Before starting to use a module, it needs to be initialized. During this process, Waspmote’s SPI bus has to be opened to
communicate with the module, and the LoRa module’s switch has to be set on.
Note:
This module does not save the configuration. So, the network settings as the mode or the channel MUST be configured
every time it is switched on.
6.1. Setting on
It initializes all the global variables, opens the SPI bus and switches the LoRa module on.
When setting on, the module always has the configuration by default shown in the next table:
Global variable
Description
Initial value
modem
activated mode
LORA
bandwidth
bandwidth to use in LoRa
TM
mode
BW_125
codingRate
coding rate to use in LoRa
TM
mode
CR_5
spreadingFactor
spreading factor to use in LoRa
TM
mode
SF_7
channel
transmission frequency channel
CH_12_900
header
specifies if header is enabled
HEADER_ON
CRC
specifies if CRC is enabled
CRC_OFF
power
power transmission level
15
Figure: Configuration by default
Also, there are other global variables initialized when this function is called, shown in the following table:
Global variable
Description
Initial value
packetNumber
packet number to send
0
reception
specifies if packet is correctly received
CORRECT_PACKET
retries
number of the current retrying that is
being executed in the protocol
0
maxRetries
maximum number of retries permitted
in each case
3
Figure: Global variables initialized by software
Example of use:
{
sx1272.ON(); // Opens the SPI and switches the SX1272 module ON
}
6.2. Setting off
It closes the SPI and switches the SX1272 module off.
Example of use:
{
sx1272.OFF(); // Closes the SPI and switches the SX1272 module off
}