Skip to content

Commit 2cee5f7

Browse files
Jordan YatesMani-Sadhasivam
authored andcommitted
LoRaMac: query minimum tx datarate
ADR allows end devices to adapt to degraded RF conditions by dropping the datarate until the server responds with a downlink packet in response to the ADRACKReq bit being set. In the case when the network connection has been lost, ADR will reduce the tx datarate to the minimum possible value, then take no further action. By adding the ability to query the minimum possible tx datarate, applications can detect when this condition has occured, and take appropriate action to rectify it. This functionality must be integrated into the stack as the minimum datarate depends on the current value of UplinkDwellTime, which is not available externally. Signed-off-by: Jordan Yates <[email protected]>
1 parent 86dfa4e commit 2cee5f7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/mac/LoRaMac.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,15 @@ LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t* mibGet )
35673567
mibGet->Param.JoinAcceptDelay2 = MacCtx.NvmCtx->MacParams.JoinAcceptDelay2;
35683568
break;
35693569
}
3570+
case MIB_CHANNELS_MIN_TX_DATARATE:
3571+
{
3572+
getPhy.Attribute = PHY_MIN_TX_DR;
3573+
getPhy.UplinkDwellTime = MacCtx.NvmCtx->MacParams.UplinkDwellTime;
3574+
phyParam = RegionGetPhyParam( MacCtx.NvmCtx->Region, &getPhy );
3575+
3576+
mibGet->Param.ChannelsMinTxDatarate = phyParam.Value;
3577+
break;
3578+
}
35703579
case MIB_CHANNELS_DEFAULT_DATARATE:
35713580
{
35723581
mibGet->Param.ChannelsDefaultDatarate = MacCtx.NvmCtx->MacParamsDefaults.ChannelsDatarate;

src/mac/LoRaMac.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ typedef struct sMlmeIndication
12581258
* \ref MIB_JOIN_ACCEPT_DELAY_1 | YES | YES
12591259
* \ref MIB_JOIN_ACCEPT_DELAY_2 | YES | YES
12601260
* \ref MIB_CHANNELS_DATARATE | YES | YES
1261+
* \ref MIB_CHANNELS_MIN_TX_DATARATE | YES | NO
12611262
* \ref MIB_CHANNELS_DEFAULT_DATARATE | YES | YES
12621263
* \ref MIB_CHANNELS_TX_POWER | YES | YES
12631264
* \ref MIB_CHANNELS_DEFAULT_TX_POWER | YES | YES
@@ -1562,6 +1563,14 @@ typedef enum eMib
15621563
* LoRaWAN Regional Parameters V1.0.2rB
15631564
*/
15641565
MIB_JOIN_ACCEPT_DELAY_2,
1566+
/*!
1567+
* Minimum Data rate of a channel
1568+
*
1569+
* LoRaWAN Regional Parameters V1.0.2rB
1570+
*
1571+
* The possible values are region specific. Please refer to \ref DR_0 to \ref DR_15 for details.
1572+
*/
1573+
MIB_CHANNELS_MIN_TX_DATARATE,
15651574
/*!
15661575
* Default Data rate of a channel
15671576
*
@@ -1964,6 +1973,12 @@ typedef union uMibParam
19641973
* Related MIB type: \ref MIB_JOIN_ACCEPT_DELAY_2
19651974
*/
19661975
uint32_t JoinAcceptDelay2;
1976+
/*!
1977+
* Channels minimum tx data rate
1978+
*
1979+
* Related MIB type: \ref MIB_CHANNELS_MIN_TX_DATARATE
1980+
*/
1981+
int8_t ChannelsMinTxDatarate;
19671982
/*!
19681983
* Channels data rate
19691984
*

0 commit comments

Comments
 (0)