How to manage max packet size with ADR?

I see that you get Error 87 when trying to send a message that is larger than what the current Region+DR supports.

So when using ADR…

  1. What’s the best way to know what the current DR is? (because it can change unexpectedly!)
  2. Can the 4200 tell us the current max packet size, or do I need to build my own lookup table for that?
  3. Is there a way to set minimum/maximum DR for ADR mode? Or set a DR mask?

Welcome to RAK forum @kb72

  1. You can check the current data rate using at+get_config=lora:status.
  2. You need to have a lookup table or array to know what max packet size you can send. There is no command to determine it currently. The max payload is also determined by region RAK4200 Module AT Command Manual | RAKwireless Documentation Center.
  3. You cannot set the min/max DR when ADR is enabled.

This is a limitation of LoRaWAN. If you think you’ll have a changing DR because of your distance to the gateway, then you have to consider the worst possible DR to be set by the ADR algorithm.

If your gateway and devices are in a fix distance. You can probably turn off ADR and just determine what is the optimal DR for your application. The case will be different if you are using a public network and have no control on the gateway.

It’s not the gateway that controls this, but the network servers

Yes. The DR is set by the network server. But the ADR algorithm is based on the SNR which is a factor of distance and/or obstruction between the device and the gateway. Though the network server determines it, in terms of deployment, whether ADR should be on/off or what is the optimal DR is still based on the device and gateway :slight_smile:

So if he use a public network and has no control on which gateway his device will connect, there will more to consider. Unlike if he controls the gateway/s and device. At least he can have a figure what can be the optimal DR to use.

If ADR is on or off is somewhat under control of the device, though there are necessary commands from the network servver that are implicitly ADR even if ADR is nominally off.

But the fact remains that the “gateway” has zero role in it whatsoever. Gateways don’t really “do” anything in LoRaWAN other than passively transfer traffic, only devices and servers make actual decisions.

has no control on which gateway his device will connect

Devices don’t connect to gateways - they connect through gateways to network servers, and the connection has no regard for which gateway it was achieved through.

A device can only connect to the servers of the network with which it has been registered, the servers of any other network will simply ignore traffic from an unkown device reported in by their gateways.

1 Like

I agree with you @cstratton :+1:

Probably I wasn’t able to explain well the scenario in which the gateway has critical role in the ADR.

ADR algorithm will set the DR based on SNR. And the SNR is based on the link between the device and the gateway. This is the info that the network server needs to determine which DR it should set.

If a certain application has 1 gateway and 1 device (just an example), the application developer can actually determine the SNR of the device and can probably disable totally the ADR on the device side and just have a fixed DR.

Thanks all. Gateway + Chirpstack LNS are the same box for our application.