A very easy to understand LoRaWAN-node code.

Dependencies:   LoRaWAN-lib SX1272Lib X_NUCLEO_IKS01A1 mbed

Important parameters:

• In comissioning.h: DevEUI, AppEUI, AppKEY, DevADR, NwksKEY, AppsKEY, OTAA and public network. Frequency and channel block to use, confirmed or unconfirmed messages, app port, app data size and OTAA and Tx duty cycles.

• In LoRaMac.h: Maximum payload and MAC commands length, receive delays, max FCNT, adr ack limit, timeout and delay, max ack retries, rssi threshold and sync words.

• In LoRaMac.cpp: Maximum payload, MAC commands and FRMpayload length.

• In LoRaMac-board.h: Tx power, data rates and band settings.

NOTE: Please refer to LoRaWAN regional parameters (page 12 for US band) to know which parameters you can modify.

Committer:
dgabino
Date:
Tue Apr 03 17:09:34 2018 +0000
Revision:
0:60ff878b27b8
A simpler way to customize your LoRaWAN payload

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dgabino 0:60ff878b27b8 1 /*
dgabino 0:60ff878b27b8 2 / _____) _ | |
dgabino 0:60ff878b27b8 3 ( (____ _____ ____ _| |_ _____ ____| |__
dgabino 0:60ff878b27b8 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
dgabino 0:60ff878b27b8 5 _____) ) ____| | | || |_| ____( (___| | | |
dgabino 0:60ff878b27b8 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
dgabino 0:60ff878b27b8 7 (C)2015 Semtech
dgabino 0:60ff878b27b8 8
dgabino 0:60ff878b27b8 9 Description: Extern declaration of parameters defined in main.cpp
dgabino 0:60ff878b27b8 10
dgabino 0:60ff878b27b8 11 License: Revised BSD License, see LICENSE.TXT file include in the project
dgabino 0:60ff878b27b8 12
dgabino 0:60ff878b27b8 13 Maintainer: Uttam Bhat
dgabino 0:60ff878b27b8 14 */
dgabino 0:60ff878b27b8 15 #ifndef __COMMON_H__
dgabino 0:60ff878b27b8 16 #define __COMMON_H__
dgabino 0:60ff878b27b8 17
dgabino 0:60ff878b27b8 18 #include "Comissioning.h"
dgabino 0:60ff878b27b8 19 #include "board.h"
dgabino 0:60ff878b27b8 20
dgabino 0:60ff878b27b8 21
dgabino 0:60ff878b27b8 22 /*!
dgabino 0:60ff878b27b8 23 * User application data buffer size
dgabino 0:60ff878b27b8 24 */
dgabino 0:60ff878b27b8 25 #define LORAWAN_APP_DATA_MAX_SIZE 64
dgabino 0:60ff878b27b8 26
dgabino 0:60ff878b27b8 27 /*!
dgabino 0:60ff878b27b8 28 * Current network ID
dgabino 0:60ff878b27b8 29 */
dgabino 0:60ff878b27b8 30 #define LORAWAN_NETWORK_ID ( uint32_t )0
dgabino 0:60ff878b27b8 31
dgabino 0:60ff878b27b8 32
dgabino 0:60ff878b27b8 33 #if( OVER_THE_AIR_ACTIVATION != 0 )
dgabino 0:60ff878b27b8 34 /*!
dgabino 0:60ff878b27b8 35 * Over the Air Activation
dgabino 0:60ff878b27b8 36 */
dgabino 0:60ff878b27b8 37
dgabino 0:60ff878b27b8 38 extern uint8_t DevEui[];
dgabino 0:60ff878b27b8 39 extern uint8_t AppEui[];
dgabino 0:60ff878b27b8 40 extern uint8_t AppKey[];
dgabino 0:60ff878b27b8 41
dgabino 0:60ff878b27b8 42 #else
dgabino 0:60ff878b27b8 43 /*!
dgabino 0:60ff878b27b8 44 * Activation by Personalization
dgabino 0:60ff878b27b8 45 */
dgabino 0:60ff878b27b8 46
dgabino 0:60ff878b27b8 47 extern uint8_t NwkSKey[];
dgabino 0:60ff878b27b8 48 extern uint8_t AppSKey[];
dgabino 0:60ff878b27b8 49 extern uint32_t DevAddr;
dgabino 0:60ff878b27b8 50
dgabino 0:60ff878b27b8 51 #endif
dgabino 0:60ff878b27b8 52
dgabino 0:60ff878b27b8 53
dgabino 0:60ff878b27b8 54 extern uint8_t AppData[LORAWAN_APP_DATA_MAX_SIZE]; // User application data size
dgabino 0:60ff878b27b8 55
dgabino 0:60ff878b27b8 56 extern uint8_t AppPort; // Application port
dgabino 0:60ff878b27b8 57
dgabino 0:60ff878b27b8 58 extern uint8_t AppDataSize; // Application size
dgabino 0:60ff878b27b8 59
dgabino 0:60ff878b27b8 60 extern uint8_t IsTxConfirmed; // Indicates if the node is sending confirmed or unconfirmed messages
dgabino 0:60ff878b27b8 61
dgabino 0:60ff878b27b8 62 extern bool IsTxIntUpdate; // Indicates if a new transmit interrupt can be set
dgabino 0:60ff878b27b8 63
dgabino 0:60ff878b27b8 64 extern bool NextTx; // Indicates if a new packet can be sent
dgabino 0:60ff878b27b8 65
dgabino 0:60ff878b27b8 66 extern bool IsNetworkJoinedStatusUpdate; // Indicates if the MAC layer network join status has changed.
dgabino 0:60ff878b27b8 67
dgabino 0:60ff878b27b8 68 extern bool IsTxUpdate; // Indicates if the message sent
dgabino 0:60ff878b27b8 69
dgabino 0:60ff878b27b8 70 extern bool IsRxUpdate; // Indicates if the message received in the RX window.
dgabino 0:60ff878b27b8 71
dgabino 0:60ff878b27b8 72 extern TimerEvent_t TxNextPacketTimer; // Timer to handle the application data transmission duty cycle
dgabino 0:60ff878b27b8 73
dgabino 0:60ff878b27b8 74 #endif // __COMMON_H__