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
Data Rate and Frequency
Select Data Rate
The data rate to use for unicast or multicast ping slots is the same data rate used to receive the beacon, as described in Section 2.3, ‘Default Settings’ (page 28) of the RP002-1.0.4 LoRaWAN® Regional Parameters specification under the setting for PING_SLOT_DATARATE.
The data rate to use depends on the region the end device will operate in. If the region your end device will operate in uses a dynamic channel plan, find the default beacon data rate in the ‘Class B beacon and default downlink channel’ subsection for the region in Section 2 of the RP002-1.0.4 LoRaWAN Regional Parameters specification. For all other regions, the beacon data rate is found in the ‘Class B beacon’ subsection within the section for the region.
Select Frequency
The frequency to use for unicast or multicast ping slots depends on the region your end device will operate in.
If the region your end device will operate in uses a dynamic channel plan, the frequency to use is described as the ‘Class B default downlink pingSlot frequency’ in the ‘Class B beacon and default downlink channel’ subsection for the region in Section 2 of the RP002-1.0.4 LoRaWAN Regional Parameters specification.
For the CN470 region, section 2.9.8 ‘CN470-510 Class B Beacon’ (page 60) of the LoRaWAN Link Layer Specification v1.0.4 describes how to work out which frequency will be used.
For the US915 and AU915 regions, the end device must use the channel defined by following the algorithm defined in section 14.2 ‘Frequency-Hopping Beacon Transmission’ (page 73) of the LoRaWAN Link Layer Specification v1.0.4 which explains how to use the Time field of the preceding beacon and the DevAddr to calculate the channel to use for a given ping slot.
Handle Requests to Update Downlink Frequency and Data Rate
The network server may request the end device change the frequency and data rate that unicast downlinks will be received on by sending the PingSlotChannelReq MAC command. Learn how to receive MAC commands in the Handling MAC Commands of the Receiving Messages Book. The received PingSlotChannelReq MAC command must be validated to ensure the specified frequency and data rate are compatible with its radio. The end device then informs the network server of whether it could use the new frequency and data rate or not by sending the PingSlotChannelAns MAC command as soon as possible using a Class A uplink. Learn about sending uplinks containing MAC commands in the section Sending MAC Commands of the Sending Messages Book.
Details of the PingSlotChannelReq and PingSlotChannelAns MAC commands can be found in section 12.3 ‘PingSlotChannelReq’ (page 64) of the LoRaWAN Link Layer Specification v1.0.4.
When an end device sends a PingSlotChannelAns confirming it can use the new frequency and data rate, the network server will update the frequency and data rate it uses for sending Class B unicast downlinks, and the end device must now listen for such downlinks on the new frequency and data rate. The new single frequency replaces any frequency-hopping algorithm currently in use.
The network server can request the end device return to its default frequency setting by sending a PingSlotChannelReq MAC command with the Frequency field set to 0. After the end device responds confirming that this is possible, it must return to using the default frequency, including any frequency-hopping algorithms previously in use.