Semtech / LMiC

Dependents:   lora-temperature LoRaWAN-lmic-app_HS LoRaWAN-lmic-app_huynh

LoRa WAN in C for sx1276 shield

Currently version 1.5


LoRaWAN network configuration for end-device

The following three pieces of information uniquely identifies end-device to network to allow over-the-air activation. These are stored in the end-device prior to join procedure.

AppEUI

Uniquely identifies application provider of end-device.

Least-significant byte first, 8 bytes, use reverse memcpy() to keep same order as shown on lora server.

example C code

static const u1_t APPEUI[8]  = { 0x01, 0x00, 0x01, 0x00, 0x00, 0x0C, 0x25, 0x00 };

This is copied into LMIC by os_getArtEui() callback function in application.

DevEUI

End-device ID, unique to each end-node.

Least-significant byte first, 8 bytes, use reverse memcpy() to keep same order as shown on lora server.

example C code

static const u1_t DEVEUI[8]  = { 0x00, 0x00, 0x00, 0x00, 0x01, 0x0C, 0x25, 0x00 }; 

This is copied into LMIC by os_getDevEui() callback function in application.

AppKey (aka DevKey)

128-bit (16byte) AES key.

example C code

static const u1_t DEVKEY[16] = { 0xe4, 0x72, 0x71, 0xc5, 0xf5, 0x30, 0xa9, 0x9f, 0xcf, 0xc4, 0x0e, 0xab, 0xea, 0xd7, 0x19, 0x42 };

This is copied into LMIC by os_getDevKey() callback function in application.

Using over-the air activation, the end-device (LMIC) performs a join procedure every time it starts for first time, or has lost session context information. When join procedure has successfully completed, the end-device will have a network session key (NwkSKey) and an application session key (AppSKey), which are used for encryption and message integrity check.


US915 configuration with http://us01-iot.semtech.com/

  • log in to server
  • click on Applications
  • find your application and click it
  • go to configure motes
  • to create a mote, you may enter a new DevEUI
    • you may copy-paste the 16byte application key from an already existing mote, if you desire.
CHNL_HYBRID125KHz500KHz
defined valuechannelschannel
00 to 764
18 to 1565
216 to 2366
324 to 3167
432 to 3968
540 to 4769
648 to 5570
756 to 6371
undef0 to 6364 to 71
Committer:
mluis
Date:
Thu Jan 22 12:50:49 2015 +0000
Revision:
0:62d1edcc13d1
Porting of IBM LoRa MAC in C (LMiC) to the mbed platform.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:62d1edcc13d1 1 /* Copyright (c) 2012 mbed.org, MIT License
mluis 0:62d1edcc13d1 2 *
mluis 0:62d1edcc13d1 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mluis 0:62d1edcc13d1 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
mluis 0:62d1edcc13d1 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
mluis 0:62d1edcc13d1 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
mluis 0:62d1edcc13d1 7 * furnished to do so, subject to the following conditions:
mluis 0:62d1edcc13d1 8 *
mluis 0:62d1edcc13d1 9 * The above copyright notice and this permission notice shall be included in all copies or
mluis 0:62d1edcc13d1 10 * substantial portions of the Software.
mluis 0:62d1edcc13d1 11 *
mluis 0:62d1edcc13d1 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mluis 0:62d1edcc13d1 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mluis 0:62d1edcc13d1 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mluis 0:62d1edcc13d1 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mluis 0:62d1edcc13d1 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mluis 0:62d1edcc13d1 17 */
mluis 0:62d1edcc13d1 18
mluis 0:62d1edcc13d1 19 #ifndef DEBUG_H
mluis 0:62d1edcc13d1 20 #define DEBUG_H
mluis 0:62d1edcc13d1 21
mluis 0:62d1edcc13d1 22 /** @file debug.h */
mluis 0:62d1edcc13d1 23
mluis 0:62d1edcc13d1 24 #ifndef NDEBUG
mluis 0:62d1edcc13d1 25
mluis 0:62d1edcc13d1 26 #include <stdarg.h>
mluis 0:62d1edcc13d1 27 #include <stdio.h>
mluis 0:62d1edcc13d1 28
mluis 0:62d1edcc13d1 29 /** Output a debug message
mluis 0:62d1edcc13d1 30 *
mluis 0:62d1edcc13d1 31 * @param format printf-style format string, followed by variables
mluis 0:62d1edcc13d1 32 */
mluis 0:62d1edcc13d1 33 static inline void debug(const char *format, ...) {
mluis 0:62d1edcc13d1 34 va_list args;
mluis 0:62d1edcc13d1 35 va_start(args, format);
mluis 0:62d1edcc13d1 36 vfprintf(stderr, format, args);
mluis 0:62d1edcc13d1 37 va_end(args);
mluis 0:62d1edcc13d1 38 }
mluis 0:62d1edcc13d1 39
mluis 0:62d1edcc13d1 40 /** Conditionally output a debug message
mluis 0:62d1edcc13d1 41 *
mluis 0:62d1edcc13d1 42 * @param condition output only if condition is true
mluis 0:62d1edcc13d1 43 * @param format printf-style format string, followed by variables
mluis 0:62d1edcc13d1 44 */
mluis 0:62d1edcc13d1 45 static inline void debug_if(bool condition, const char *format, ...) {
mluis 0:62d1edcc13d1 46 if(condition) {
mluis 0:62d1edcc13d1 47 va_list args;
mluis 0:62d1edcc13d1 48 va_start(args, format);
mluis 0:62d1edcc13d1 49 vfprintf(stderr, format, args);
mluis 0:62d1edcc13d1 50 va_end(args);
mluis 0:62d1edcc13d1 51 }
mluis 0:62d1edcc13d1 52 }
mluis 0:62d1edcc13d1 53
mluis 0:62d1edcc13d1 54 #else
mluis 0:62d1edcc13d1 55
mluis 0:62d1edcc13d1 56 static inline void debug(const char *format, ...) {}
mluis 0:62d1edcc13d1 57 static inline void debug(bool condition, const char *format, ...) {}
mluis 0:62d1edcc13d1 58
mluis 0:62d1edcc13d1 59 #endif
mluis 0:62d1edcc13d1 60
mluis 0:62d1edcc13d1 61 #endif