IoT Drivers  v3.3.0 (S2022)
Engineering in Software Technology
OTAA setup steps
Note
All the following code must be implemented in the initialisation part of a FreeRTOS task!
Nearly all calls to the driver will suspend the calling task while the driver waits for response from the RN2484 module.

Example code

In this use case, the driver is setup to Over The Air Activation (OTAA).

Workflow

  1. Define the necessary app identification for OTAA join:
    // Parameters for OTAA join
    #define LORA_appEUI "????????????????"
    #define LORA_appKEY "????????????????????????????????"
Note
The parameters depends on the setup of the LoRaWAN network server and will be given to you.
  1. Set the module to factory set defaults:
    {
    // Something went wrong
    }
  2. Configure the module to use the EU868 frequency plan and settings:
    {
    // Something went wrong
    }
  3. Get the RN2483 modules unique devEUI:
    static char devEui[17]; // It is static to avoid it to occupy stack space in the task
    {
    // Something went wrong
    }
  4. Set the necessary LoRaWAN parameters for an OTAA join:
    if (lora_driver_setOtaaIdentity(LORA_appEUI,LORA_appKEY,devEui) != LORA_OK)
    {
    // Something went wrong
    }
  5. Save all set parameters to the RN2483 modules EEPROM (OPTIONAL STEP):
    Note
    If this step is performed then it is no necessary to do the steps above more than once. These parameters will automatically be restored in the module on next reset or power on.
    {
    // Something went wrong
    }
    // All parameters are now saved in the module
  6. Join LoRaWAN parameters with OTAA:
    {
    // You are now joined
    }
lora_driver_join
lora_driver_returnCode_t lora_driver_join(lora_driver_joinMode_t mode)
Joins a LoRaWAN either with ABP or OTAA.
lora_driver_configureToEu868
lora_driver_returnCode_t lora_driver_configureToEu868(void)
Set the driver up to using EU868 standard.
lora_driver_getRn2483Hweui
lora_driver_returnCode_t lora_driver_getRn2483Hweui(char hwDevEUI[17])
Get the RN2483 factory set devEUI.
LORA_OK
@ LORA_OK
Definition: lora_driver.h:66
LORA_OTAA
@ LORA_OTAA
Definition: lora_driver.h:94
lora_driver_setOtaaIdentity
lora_driver_returnCode_t lora_driver_setOtaaIdentity(char appEUI[17], char appKEY[33], char devEUI[17])
Set identifiers and keys for a OTAA join.
lora_driver_saveMac
lora_driver_returnCode_t lora_driver_saveMac(void)
Save the set parameters into the EEPROM of the RN2483 module.
LORA_ACCEPTED
@ LORA_ACCEPTED
Definition: lora_driver.h:75
lora_driver_rn2483FactoryReset
lora_driver_returnCode_t lora_driver_rn2483FactoryReset(void)
Reset the RN2483 module.