5 - Class B
This book explores in depth how to use Class B in end devices implementing LoRaWAN® 1.0.4. Class B mode enables the end device to receive downlinks at regular intervals. We teach you how to configure your end device to receive Class B downlinks using beacons and ping slots and best practices to follow to increase the chance of receiving downlinks while maintaining reasonable battery life.
Listening for Class B Downlinks
Increasing the Number of Ping Slots Used in Each Beacon Window
The end device may increase the number of unicast ping slots per beacon window using the Periodicity field of the PingSlotParam octet in the PingSlotInfoReq MAC command.
Warning
Changing the Periodicity only changes the ping slots for unicast downlinks. Thus, changing the Periodicity will not affect the periodicity for multicast downlinks. The LoRaWAN® Remote Multicast Setup Specification v1.0.0 proposes an approach to managing periodicity for multicast downlinks.
Before sending the MAC command, close the Class B operations on the end device, stopping the windows that listen for beacons and ping slots.
Send the PingSlotInfoReq MAC command in a Class A uplink with the Class B Enabled Bit (ClassB) set to 0. Learn about sending uplinks containing MAC commands in the section Sending MAC Commands of the Sending Messages Book.
The specification of the PingSlotInfoReq MAC command is found in section 12.1 ‘PingSlotInfoReq’ (page 62) of the LoRaWAN Link Layer Specification v1.0.4. The Periodicity value can be set between 0 and 7, which is represented as an unsigned 3-bit integer.
After sending the PingSlotInfoReq, the end device must listen for a PingSlotInfoAns with an empty payload in one of the Class A receive windows. Learn more about handling MAC commands in the section Handling MAC Commands of the Receiving Messages Book.
If no PingSlotInfoAns is received, the end device must not update its Periodicity value and must attempt to retry the MAC command. If using Adaptive Data Rate (ADR), the device must commence the backoff procedure explained in section ADR Backoff of the Implementing Adaptive Data Rate Book to try to regain connectivity with the network server.
If a PingSlotInfoAns is received, the end device must update its Periodicity value to the transmitted value. The end device can then restart Class B operations by again listening for a beacon, transmitting the Class B bit in a Class A uplink when a beacon is received, and resuming listening for downlinks.
Warning
Avoid modifying the Periodicity unless you have a strong reason to do so as it directly affects the number of ping slots opened during the beacon window and increases power consumption. For example, a Periodicity of 0 means a ping slot is opened every second during the beacon window. Any value lower than 7 means there is more than one ping slot opened during the beacon window. Choose the value carefully, using the Periodicity algorithm described in section Timing of Ping Slot Windows.