LoRa Basics Modem and LoRa Edge documentation

Scenario - LoRa Basics™ Almanac Update

Introduction

The LR1110 is able to reduce GNSS scanning time by taking into account coarse orbital parameters for different GNSS constellations (the almanac parameters). In conjunction with a coarse time and position estimate, the LR1110 uses this information to optimize the search for, and acquisition of, GNSS signals. Over time, the true satellite positions diverge from the stored almanac parameters. This means that those parameters need to be updated regularly.

The LoRa Cloud Device & Application Services Over-the-Air (OTA) GNSS almanac update feature allows a device built on the LR1110 with LoRa Basics Modem-E firmware to automatically perform efficient partial almanac updates over a LoRaWAN® network. The almanac is stored entirely in flash memory; therefore, it is kept after power-off, and after sleep mode without retention.

Once enabled, the OTA GNSS almanac update process is carried out by the LoRa Basics Modem-E without any action on the host MCU side.

Note

A full almanac update can also be triggered by the device application. For details, see User Loaded Almanac Update.

Compatibility

LoRa Basics Modem

LoRa Basics Modem-E

Prerequisites

Common:

  • The end device must have joined the network.

  • The application server forwards uplinks on a configured device management (DM) FPort (199 by default) to das.loracloud.com.

  • The application server forwards LoRa Cloud Device & Application Services downlinks to the end device.

Step-by-Step Procedure

To use automatic almanac updates managed by the LoRa Cloud Device & Application Services, the LoRa Basics Modem-E must send its almanac status as part of its device management uplinks.

To enable this function, add the field DM_INFO_TYPE_GNSS_ALMANAC_STATUS to the DM frame, using the set_dm_info_field() command. The almanac will then be kept up-to-date by the LoRa Cloud Device & Application Services, without further action from the device application.

Sample Code

Use the following sample code to activate automatic almanac updates on the device:

#include "lr1110_modem_lorawan.h"
lr1110_modem_dm_info_fields_t dm_info_fields;
lr1110_modem_response_code_t set_dm_info_field_response_code;

/* Set DM info field */
dm_info_fields.dm_info_field[0] = LR1110_MODEM_DM_INFO_TYPE_GNSS_ALMANAC_STATUS;
/*
 * This command erases the previous fields activated in the
 * modem, and adds all the fields required by the application.
 */
dm_info_fields.dm_info_field[1] = LR1110_MODEM_DM_INFO_TYPE_CHARGE;
dm_info_fields.dm_info_field[2] = LR1110_MODEM_DM_INFO_TYPE_TEMPERATURE;
dm_info_fields.dm_info_field[3] = LR1110_MODEM_DM_INFO_TYPE_VOLTAGE;
dm_info_fields.dm_info_length   = 4;

set_dm_info_field_response_code = lr1110_modem_set_dm_info_field(
  &context,
  &dm_info_fields
);

Adjust the DM frame interval to trigger almanac updates:

#include "lr1110_modem_lorawan.h"
lr1110_modem_response_code_t set_dm_info_field_response_code;

/*
 * Set DM interval to 1 hour
 * Units can be:
 * - LR1110_MODEM_REPORTING_INTERVAL_IN_SECOND
 * - LR1110_MODEM_REPORTING_INTERVAL_IN_DAY
 * - LR1110_MODEM_REPORTING_INTERVAL_IN_HOUR
 * - LR1110_MODEM_REPORTING_INTERVAL_IN_MINUTE
 */
set_dm_info_field_response_code = lr1110_modem_set_dm_info_interval(
  &context,
  LR1110_MODEM_REPORTING_INTERVAL_IN_HOUR,
  1
);

In-Depth Behavior

A value representing the almanac state is embedded in the DM frame every time it is sent by the modem. The LoRa Cloud Device & Application Services can then determine whether the device’s almanac data needs to be updated. If it does, the LoRa Cloud Device & Application Services create a downlink with updated almanac data to be sent to the modem.

Note

The LoRa Cloud Device & Application Services API parameter dn_mtu is important and should be provided in the LoRa Cloud Device & Application Services query if it is known by the application server. (For details, see the Uplink documentation.) This parameter tells the LoRa Cloud Device & Application Services how many bytes can be put in the downlink, which can increase the update speed and lower the number of downlinks required to update the device almanac. The minimum downlink MTU supported by the LoRa Cloud Device & Application Services for updating the almanac is 28 bytes.

Note

By default the LoRa Cloud Device & Application Services assume an available downlink MTU of 51 bytes. This corresponds to the minimum defined by the LoRaWAN specification in most regions.

@startumltitle Modem-E DAS Managed Almanac Updatebox Device #ADD8E6    participant "End-Device\nApplication" as UC #ADD8E6    participant "LoRa Basics™\nModem(s)" as modem #00ADEFend boxbox LoRaWAN® #AAAAAA    participant "Network Server" as NS  #D3D3D3end boxbox Cloud #ADD8E6    participant "Application Server" as AS #ADD8E6end boxbox LoRa Cloud™ #00ADEF    participant "Device & Application Services" as DAS #00ADEFend boxlegend left|=             |= Owner || <#00ADEF>    | Semtech || <#ADD8E6>    | Customer || <#D3D3D3>    | Ecosystem |endlegendUC -> modem: Enable OTA almanac updates\nthanks to SetDmInfoField()alt Outdated entries in Alamanac    modem -> AS ++: DmStatus    AS -> DAS ++: DmStatus    return Partial almanac\nupdate downlink    return Partial almanac\nupdate downlinkendalt Almanac up to date    modem -> AS : DmStatus    AS -> DAS : DmStatus    note right: Almanac up to date,\nno downlink answered.end@enduml

Note

The most effective way to keep the almanac up-to-date from a data volume perspective is to send the GNSS almanac status (via the DM frame) every two or three days.

Used By

GNSS

Troubleshooting

End-Device almanac is not automatically updated

The DM frame has probably not been delivered to the LoRa Cloud Device & Application Services, or the LoRa Cloud Device & Application Services answer has not reached the modem.

  1. Check that uplinks are correctly delivered to the LoRa Cloud Device & Application Services.

  2. Check that the LoRa Cloud Device & Application Services are creating a downlink response.

  3. Ensure that the LoRa Cloud Device & Application Services downlinks are being sent to the modem by the application server and the LoRaWAN network server.

References

  1. LoRa Basics™ Modem-E Reference Manual

  2. LoRa Cloud™ Device & Application Services