IoT Drivers  v3.3.0 (S2022)
Engineering in Software Technology
Advanced LoRa driver functions

Advanced LoRaWAN functions. These functions you will not normally need, it will normally be enough to use the simple functions. More...

Collaboration diagram for Advanced LoRa driver functions:

Functions

lora_driver_returnCode_t lora_driver_setDeviceIdentifier (const char devEUI[17])
 Set the device EUI. More...
 
lora_driver_returnCode_t lora_driver_setApplicationIdentifier (const char appEUI[17])
 Set the Application EUI. More...
 
lora_driver_returnCode_t lora_driver_setApplicationKey (const char appKey[33])
 Set the Application Key. More...
 
lora_driver_returnCode_t lora_driver_setNetworkSessionKey (const char nwkSKey[33])
 Set the Network Session Key. More...
 
lora_driver_returnCode_t lora_driver_setApplicationSessionKey (const char appSKey[33])
 Set the Application Session Key. More...
 
lora_driver_returnCode_t lora_driver_setDeviceAddress (const char devAddr[9])
 Set the Device address. More...
 
lora_driver_returnCode_t lora_driver_setDataRate (uint8_t dr)
 Set data rate. More...
 
lora_driver_returnCode_t lora_driver_getDataRate (uint8_t *dr)
 Get data rate. More...
 
lora_driver_returnCode_t lora_driver_setAdaptiveDataRate (lora_driver_adaptiveDataRate_t state)
 Set adaptive data rate (ADR). More...
 
lora_driver_returnCode_t lora_driver_getAdaptiveDataRate (lora_driver_adaptiveDataRate_t *state)
 Get adaptive data rate (ADR). More...
 
lora_driver_returnCode_t lora_driver_setReceiveDelay (uint16_t rxDelay1)
 Set the delay between a transmission and the first receiver window. More...
 
lora_driver_returnCode_t lora_driver_setAutomaticReply (lora_driver_automaticReplyMode_t ar)
 Set automatic reply on down link messages. More...
 
lora_driver_returnCode_t lora_driver_getAutomaticReply (lora_driver_automaticReplyMode_t *ar)
 Get automatic reply setting for down link messages. More...
 
lora_driver_returnCode_t lora_driver_setLinkCheckInterval (uint16_t sec)
 Set the delay each link check is performed. More...
 
lora_driver_returnCode_t lora_driver_getLinkCheckResult (uint8_t *no_gwys, uint8_t *margin)
 Get the results of the latest received Link Check. More...
 
lora_driver_returnCode_t lora_driver_setSpreadingFactor (uint8_t sf)
 Set the spreading factor for the communication. More...
 
void lora_driver_resetRn2483 (uint8_t state)
 Controls the reset pin on the RN2483 Module. More...
 
void lora_driver_flushBuffers (void)
 Flush the internal buffers in the driver. More...
 
lora_driver_returnCode_t lora_driver_sleep (uint32_t ms)
 Set the RN2384 module in sleep mode for a given periode. More...
 
lora_driver_returnCode_t lora_driver_pauseMac (void)
 Pause the MAC layer in the RN2483 module. More...
 
lora_driver_returnCode_t lora_driver_resumeMac (void)
 Resume the MAC layer in the RN2483 module. More...
 

Detailed Description

Advanced LoRaWAN functions. These functions you will not normally need, it will normally be enough to use the simple functions.

Function Documentation

◆ lora_driver_flushBuffers()

void lora_driver_flushBuffers ( void  )

Flush the internal buffers in the driver.

◆ lora_driver_getAdaptiveDataRate()

lora_driver_returnCode_t lora_driver_getAdaptiveDataRate ( lora_driver_adaptiveDataRate_t state)

Get adaptive data rate (ADR).

see also lora_driver_setAdaptiveDataRate.

Parameters
[out]statethe current state of ADR.
Returns
lora_driver_returnCode

◆ lora_driver_getAutomaticReply()

lora_driver_returnCode_t lora_driver_getAutomaticReply ( lora_driver_automaticReplyMode_t ar)

Get automatic reply setting for down link messages.

see also lora_driver_setAutomaticReply.

Parameters
[out]arcurrent state of automatic response.
Returns
lora_driver_returnCode

◆ lora_driver_getDataRate()

lora_driver_returnCode_t lora_driver_getDataRate ( uint8_t *  dr)

Get data rate.

The data rate determines the spreading factor and bit rate on the LoRaWAN. For more information see LoRaWA Regional Parameters v1.1rB

lora_driver_setDataRate.

Parameters
[out]drdata rate as set in module.
Returns
lora_driver_returnCode

◆ lora_driver_getLinkCheckResult()

lora_driver_returnCode_t lora_driver_getLinkCheckResult ( uint8_t *  no_gwys,
uint8_t *  margin 
)

Get the results of the latest received Link Check.

See also
lora_driver_setLinkCheckInterval

This function will return the no of gwy's that was seeing the device at latest upload command, and also the demodulation margin (Margin) in the range of 0..254 indicating the link margin in dB of the last successfully received LinkCheckReq command. A value of '0' means that the frame was received at the demodulation floor (0 dB or no margin) while a value of '20', for example, means that the frame reached the gateway 20 dB above the demodulation floor.

Parameters
[out]no_gwysthat successfully received over last upload message.
[out]marginthe demodulation margin [dB]
Returns
lora_driver_returnCode

◆ lora_driver_pauseMac()

lora_driver_returnCode_t lora_driver_pauseMac ( void  )

Pause the MAC layer in the RN2483 module.

This must be done before any commands are send to the radio layer.

Returns
lora_driver_returnCode

◆ lora_driver_resetRn2483()

void lora_driver_resetRn2483 ( uint8_t  state)

Controls the reset pin on the RN2483 Module.

Parameters
[in]state1: reset is active, 0: reset is released.

◆ lora_driver_resumeMac()

lora_driver_returnCode_t lora_driver_resumeMac ( void  )

Resume the MAC layer in the RN2483 module.

This must be done after a pause is finished.

Returns
lora_driver_returnCode

◆ lora_driver_setAdaptiveDataRate()

lora_driver_returnCode_t lora_driver_setAdaptiveDataRate ( lora_driver_adaptiveDataRate_t  state)

Set adaptive data rate (ADR).

If ADR is ON the server will optimize the data rate and transmission power based on the last received up-link message.

Parameters
[in]statethe wanted ADR state.
Returns
lora_driver_returnCode

◆ lora_driver_setApplicationIdentifier()

lora_driver_returnCode_t lora_driver_setApplicationIdentifier ( const char  appEUI[17])

Set the Application EUI.

Note
This is normally done by using lora_driver_setOtaaIdentity.
Only needed when OTAA is used.
Parameters
[in]appEUI16 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setApplicationKey()

lora_driver_returnCode_t lora_driver_setApplicationKey ( const char  appKey[33])

Set the Application Key.

Note
This is normally done by using lora_driver_setOtaaIdentity.
Only needed when OTAA is used.
Parameters
[in]appKey32 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setApplicationSessionKey()

lora_driver_returnCode_t lora_driver_setApplicationSessionKey ( const char  appSKey[33])

Set the Application Session Key.

Note
This is normally done by using lora_driver_setAbpIdentity.
Only needed when ABP is used.
Parameters
[in]appSKey32 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setAutomaticReply()

lora_driver_returnCode_t lora_driver_setAutomaticReply ( lora_driver_automaticReplyMode_t  ar)

Set automatic reply on down link messages.

By enabling the automatic reply, the module will transmit a packet without a payload immediately after a confirmed downlink message is received, or when the Frame Pending bit has been set by the server. If set to OFF, no automatic reply will be transmitted.

Parameters
[in]arnew state of automatic response.
Returns
lora_driver_returnCode

◆ lora_driver_setDataRate()

lora_driver_returnCode_t lora_driver_setDataRate ( uint8_t  dr)

Set data rate.

The data rate determines the spreading factor and bit rate on the LoRaWAN. For more information see LoRaWA Regional Parameters v1.1rB

Parameters
[in]dr[0..7] data rate to be used for next transmissions.
Returns
lora_driver_returnCode

◆ lora_driver_setDeviceAddress()

lora_driver_returnCode_t lora_driver_setDeviceAddress ( const char  devAddr[9])

Set the Device address.

Note
This is normally done by using lora_driver_setAbpIdentity.
Only needed when ABP is used.
Parameters
[in]devAddr8 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setDeviceIdentifier()

lora_driver_returnCode_t lora_driver_setDeviceIdentifier ( const char  devEUI[17])

Set the device EUI.

Note
This is normally done by using lora_driver_setOtaaIdentity.
Only needed when OTAA is used.
Parameters
[in]devEUI16 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setLinkCheckInterval()

lora_driver_returnCode_t lora_driver_setLinkCheckInterval ( uint16_t  sec)

Set the delay each link check is performed.

This command sets the time interval for the link check process to be triggered periodically. A value of '0' will disable the link check process. When the time interval expires, the next upload message that will be sent to the server will include also a link check MAC command.

Parameters
[in]sectime between link check is performed [s]. 0: turn off link check.
Returns
lora_driver_returnCode

◆ lora_driver_setNetworkSessionKey()

lora_driver_returnCode_t lora_driver_setNetworkSessionKey ( const char  nwkSKey[33])

Set the Network Session Key.

Note
This is normally done by using lora_driver_setAbpIdentity.
Only needed when ABP is used.
Parameters
[in]nwkSKey32 byte hexadecimal string.
Returns
lora_driver_returnCode

◆ lora_driver_setReceiveDelay()

lora_driver_returnCode_t lora_driver_setReceiveDelay ( uint16_t  rxDelay1)

Set the delay between a transmission and the first receiver window.

This command will set the delay between the transmission and the first Reception window to

rxDelay1

in milliseconds. The delay between the transmission and the second Reception window is calculated in software as the delay between the transmission and the first Reception window + 1000 ms.

Parameters
[in]rxDelay1the delay in ms - default is 1000.
Returns
lora_driver_returnCode

◆ lora_driver_setSpreadingFactor()

lora_driver_returnCode_t lora_driver_setSpreadingFactor ( uint8_t  sf)

Set the spreading factor for the communication.

The spreading factor (SF) ....

Todo:
spreading factor (SF) needs more explanation!
Parameters
[in]sfspreading factor to be used.
Returns
lora_driver_returnCode

◆ lora_driver_sleep()

lora_driver_returnCode_t lora_driver_sleep ( uint32_t  ms)

Set the RN2384 module in sleep mode for a given periode.

This command puts the system to Sleep for the specified number of milliseconds. The module can be forced to exit from Sleep by sending a break condition followed by a 0x55 character at the new baud rate. Note that the break condition needs to be long enough not to be interpreted as a valid character at the current baud rate.

Todo:
Implement lora_driver_sleep function.
Note
If the module is in sleep mode it will save battery power.
Parameters
[in]msThe number of milliseconds to sleep [100-4294967296].