RAK811 ADR problem

Hi Fomi,
maybe I am wrong, but I am worry ADR doesn’t work at 3.x.x.x version.

  1. I set by at-commands all needed parameters including
    at+set_config=lora:adr:1\r\n // ADR on
    at+set_config=lora:dr:0\r\n // SF12

  2. then in cycle 2 min I send a data
    at+send=lora:2:1234

Data are received by LoraWan-server ok, but the SF and Power is the same all the time.

Do you think the problem could be on my side, if you thoroughly tested ADR?
Thank
Ant

Hi @Hofmann,

Yes, i’m sure that RAK811 v3.x.x.x firmware has ADR, and it works well because we’ve ever tested it.
Maybe you can check whether LoRaWAN server has sent ADR downlink command?

Thanks for your hint, I will check it…

unfortunately no progress…

  1. after power on, DataRate is set to 5 (SF7) by default, I set it to SF12 (lora:dr:0)
    Current Datarate = 0 (SF12)
    Primeval Datarate = 0 (SF12)

  2. down link with command SF10, when down link is received I can see in lora:status
    Current Datarate = 2 (change to SF10)
    Primeval Datarate = 0 (SF12)

  3. next send data
    !! data transmission is done by SF12 no SF10 !!
    Current Datarate = 0 (SF12, SF10 lost )
    Primeval Datarate = 0 (SF12)

Results:

  • DataRata doesn’t change by ADR
  • Power is changed by ADR OK !
  • When I put 2.x.x.x to the chip, everything is OK

I set by at-commands all needed parameters including
at+set_config=lora:adr:0\r\n // ADR on
at+set_config=lora:dr:5\r\n // SF7
then I send a data
at+send=lora:1:00112233445566
I get the figure by looking at the data

!
Then I send the AT command again
at+set_config=lora:adr:0\r\n // ADR on
at+set_config=lora:dr:1\r\n // SF11
at+send=lora:1:00112233445566
and get the result shown here.

Finally, I turn on the ADR and set the following command:
at+set_config=lora:adr:1\r\n // ADR off
at+set_config=lora:dr:5\r\n // SF11
at+send=lora:1:00112233445566
The resulting data is shown in the figure below

Hi Nicholas,
thanks for your kind help, I can see your exmaple and I understand it.

But look at this:

My server sends a downlink with request to change the DR to 5 (SF7)

Joined Network:true
IsConfirm: true
Work Mode: LoRaWAN
AdrEnable: true
EnableRepeaterSupport: false
RX2_CHANNEL_FREQUENCY: 869525000, RX2_CHANNEL_DR:0
RX_WINDOW_DURATION: 3000ms
RECEIVE_DELAY_1: 1000ms
RECEIVE_DELAY_2: 2000ms
JOIN_ACCEPT_DELAY_1: 5000ms
JOIN_ACCEPT_DELAY_2: 6000ms
Current Datarate: 5
Primeval Datarate: 1
ChannelsTxPower: 0
UpLinkCounter: 14
DownLinkCounter: 14
AntennaGain: 2.15

RAK accepted it ( see Current Datarate: 5 ). It means next send should be at SF7.
But it is sent by SF11 (Primeval )

then
at+get_config=lora:status shows

RECEIVE_DELAY_1: 1000ms
RECEIVE_DELAY_2: 2000ms
JOIN_ACCEPT_DELAY_1: 5000ms
JOIN_ACCEPT_DELAY_2: 6000ms
Current Datarate: 1
Primeval Datarate: 1
ChannelsTxPower: 0
UpLinkCounter: 15
DownLinkCounter: 15
AntennaGain: 2.15

Can you tell me what the configuration is when you send data through the server?

you mean configuration of RAK or LoRa server ?

  1. If you publish the source code, will you please send me a copy now, I will try to debug it here and find the issue. I have done it the same way for 2.x.x.x version, where a problem was with ADR after sleep-wake up.

  2. If not, can you please put this new debug messages ( just for test now)

  • LinkADRReq accepted SF:%d Power:%d
  • Data sent with SF:%d

( notice at my previous picture, Power is changed by ADR ok, but SF not )

Thanks for your kind help, RAK is a great product and we are going to use it, but our local radio-authority didn’t pass an exam test because of the ADR problem…

Ant

please tell me configuration of the lorawan server.

Hi @Hofmann,

Thank you for your recognition for RAK.
Yes, the 3.x.x.x version firmware is developed based on RAK SDK named RUI, and it is not fully open source.
We can make a test firmware to add the debug message you metioned surely. If we get it, i can send it to you ASAP.
Please tell me your email, thank you!

great ! I will send you the result then
[email protected]

Hi @Hofmann,

Please download the test firmware from here:
https://github.com/RAKWireless/Update-File/blob/master/RUI_RAK811_V3.0.0.3.H_test_debug(1).bin

Hi Fomi,
this version doesn’t respond to any input… (hangs after CR LF)


Ant

Hi @Hofmann,

Please use this serial port tool:
https://downloads.rakwireless.com/en/LoRa/RAK811/Tools/RAK_SERIAL_PORT_TOOL_V1.2.1.zip

ok, now SerialPortTool works, analyzing data …
Thx Ant

the debug version doesn’t receive any downlinks, don’t you know what could be wrong ?
Thx Ant

Selected LoRaWAN 1.0.2 Region: EU868
Initialization OK,AT Uart work mode:normal mode, Current work_mode:LoRaWAN, join_mode:OTAA, Class: A
OTAA:
DevEui:D9534DF77E2AA480
AppEui:70B3D5E75F600000
AppKey:251A15393EB95EC473EA561543FD31E4
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 E3 71
MIC:66 2F 8B FB
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:5
Tx_Channel:0, Freq:868100000, DR:5, Power:13
OTAA Join Start…
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868100000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Join retry Cnt:1
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 A5 D3
MIC:22 6E 6E 44
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:4
Tx_Channel:2, Freq:868500000, DR:4, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868500000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Join retry Cnt:2
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 E5 C6
MIC:14 E5 AB 14
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:3
Tx_Channel:2, Freq:868500000, DR:3, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868500000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Join retry Cnt:3
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 32 CF
MIC:DA 45 F9 7A
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:2
Tx_Channel:1, Freq:868300000, DR:2, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868300000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Join retry Cnt:4
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 AE 17
MIC:09 37 87 AE
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:1
Tx_Channel:1, Freq:868300000, DR:1, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868300000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
OnRadioRxTimeout
[LoRa]:Join retry Cnt:5
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 0C C9
MIC:C4 17 14 B7
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:0
Tx_Channel:0, Freq:868100000, DR:0, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868100000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Join retry Cnt:6
Tx_MHDR:00, fCtrl:80, fport:0, LoRaMacTxPayloadLen:0, LoRaMacBufferPktLen:23,
PktBuffer:00 00 00 60 5F E7 D5 B3 70 80 A4 2A 7E F7 4D 53 D9 2B 55
MIC:2E CE 3C B5
CalculateBackOff
RegionCommonUpdateBandTimeOff nbBands:5,joined:0
RegionCommonUpdateBandTimeOff end
ScheduleTxstatus:0
LoRaMacParams.ChannelsDatarate:0
Tx_Channel:2, Freq:868500000, DR:0, Power:13
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
TxDone!
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx1_Freq:868500000
OnRadioRxTimeout
LoRaMacState:1,AckTimeoutRetry:0, LoRaMacState:1, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1
Rx2_Freq:869525000
OnRadioRxTimeout
[LoRa]:Joined Failed!
LoRaMacState:0,AckTimeoutRetry:0, LoRaMacState:0, AckTimeoutRetriesCounter:1, AckTimeoutRetries:1

I am back after some time and I am sorry to disturb you again, but after some experiments with 4200 I am worry ADR after sleep-wake up cycle still doesn’t work.
( ADR works, but not after sleep - wake up cycle by at commands)

I got your old base source code, there the error can be seen. I guess the same problem could be in your latest versions, if I am not wrong.

In your base code:

at_cmd.c :: static void lora_sleep(int argc, char *argv[])
{

rw_LoadUsrConfig(); // this function is called after every “at+set_config=device:sleep:X\r\n”
}

rw_lora.c :: void rw_LoadUsrConfig()
{

mibReq.Type = MIB_CHANNELS_DATARATE;
mibReq.Param.ChannelsDatarate = g_lora_config.def_tx_dr;
LoRaMacMibSetRequestConfirm( &mibReq );
rw_SetTxDataRate(g_lora_config.def_tx_dr);

}

Actual channel datarate is set to its default value, after every sleep-wake up cycle !!!
If ADR changes it, it is always overwritten by its default value…

Please put it to the programmer of the base code and let me know if I am wrong.
Thx

I can say:
You can go from SF7 to SF12, and then nothing will change, right? Unless you resend the join request?

No, no, I start at SF12 (slowest). Conditions are good so LoRaWan server sends me … go to the SF11.

Then I do “at+set_config=device:sleep:1\r\n” ( go to sleep )
After some time “at+set_config=device:sleep:0\r\n” and send data. But data are sent at SF12, because
see rw_lora.c :: void rw_LoadUsrConfig() is called, where mibReq.Param.ChannelsDatarate = g_lora_config.def_tx_dr;
is set to its default value (SF12) not SF11 what was obtained.

My source code of your modul is old, but I’m sure you got the new one :-). Can you have a look? Are there functions with the logic I described above? If yes, ADR cannot work after wake up, I guess…

LoRaWan server sends me … go to the SF11.

Can you sure the node has changed to SF11 before sleep?
Please check it by AT command : at+get_config=lora:status
image