LMIC for MOTE_L152RC

Dependents:   lmic_transmit

LoRa WAN in C for NA-mote 72

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 LMIC_reverse_memcpy() for AppEUI to keep same byte order as that 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 LMIC_reverse_memcpy() for DevEUI to keep same byte order as that 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.


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.

Information

DevEUI is entered in reverse order into C-code from that shown on server (unique device ID).

AppEUI is entered in reverse order into C-code from that shown on server.

AppEUI is equivalent to "Application"

transmit power limits

FCC Part 15 rules permit one watt of transmit power when more than 50 channels are used. When received by a 64-channel gateway, the maximum power may be used.

However, if end-device is sending to a 8-channel gateway (single SX1301), the maximum transmit power permitted is +20dBm.

To configure LMIC for use with 8-channel gateway, CHNL_HYBRID should be defined in in config.h, and should be undefined for use with 64-channel gateway.

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:
dudmuck
Date:
Tue Jun 02 19:04:29 2015 +0000
Revision:
0:f2716e543d97
lmic-v1.5 for MOTE_L152RC

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudmuck 0:f2716e543d97 1 /*******************************************************************************
dudmuck 0:f2716e543d97 2 * Copyright (c) 2014-2015 IBM Corporation.
dudmuck 0:f2716e543d97 3 * All rights reserved. This program and the accompanying materials
dudmuck 0:f2716e543d97 4 * are made available under the terms of the Eclipse Public License v1.0
dudmuck 0:f2716e543d97 5 * which accompanies this distribution, and is available at
dudmuck 0:f2716e543d97 6 * http://www.eclipse.org/legal/epl-v10.html
dudmuck 0:f2716e543d97 7 *
dudmuck 0:f2716e543d97 8 * Contributors:
dudmuck 0:f2716e543d97 9 * IBM Zurich Research Lab - initial API, implementation and documentation
dudmuck 0:f2716e543d97 10 *******************************************************************************/
dudmuck 0:f2716e543d97 11
dudmuck 0:f2716e543d97 12 #include <stdarg.h>
dudmuck 0:f2716e543d97 13 #include <stdio.h>
dudmuck 0:f2716e543d97 14
dudmuck 0:f2716e543d97 15 /** Output a debug message
dudmuck 0:f2716e543d97 16 *
dudmuck 0:f2716e543d97 17 * @param format printf-style format string, followed by variables
dudmuck 0:f2716e543d97 18 */
dudmuck 0:f2716e543d97 19 static inline void debug(const char *format, ...) {
dudmuck 0:f2716e543d97 20 va_list args;
dudmuck 0:f2716e543d97 21 va_start(args, format);
dudmuck 0:f2716e543d97 22 vfprintf(stderr, format, args);
dudmuck 0:f2716e543d97 23 va_end(args);
dudmuck 0:f2716e543d97 24 }
dudmuck 0:f2716e543d97 25
dudmuck 0:f2716e543d97 26 // intialize debug library
dudmuck 0:f2716e543d97 27 void debug_init (void);
dudmuck 0:f2716e543d97 28
dudmuck 0:f2716e543d97 29 // set LED state
dudmuck 0:f2716e543d97 30 void debug_led (u1_t val);
dudmuck 0:f2716e543d97 31
dudmuck 0:f2716e543d97 32 // write character to USART
dudmuck 0:f2716e543d97 33 void debug_char (u1_t c);
dudmuck 0:f2716e543d97 34
dudmuck 0:f2716e543d97 35 // write byte as two hex digits to USART
dudmuck 0:f2716e543d97 36 void debug_hex (u1_t b);
dudmuck 0:f2716e543d97 37
dudmuck 0:f2716e543d97 38 // write buffer as hex dump to USART
dudmuck 0:f2716e543d97 39 void debug_buf (const u1_t* buf, u2_t len);
dudmuck 0:f2716e543d97 40
dudmuck 0:f2716e543d97 41 // write 32-bit integer as eight hex digits to USART
dudmuck 0:f2716e543d97 42 void debug_uint (u4_t v);
dudmuck 0:f2716e543d97 43
dudmuck 0:f2716e543d97 44 // write nul-terminated string to USART
dudmuck 0:f2716e543d97 45 void debug_str (const char* str);
dudmuck 0:f2716e543d97 46
dudmuck 0:f2716e543d97 47 // write LMiC event name to USART
dudmuck 0:f2716e543d97 48 void debug_event (int ev);
dudmuck 0:f2716e543d97 49
dudmuck 0:f2716e543d97 50 // write label and 32-bit value as hex to USART
dudmuck 0:f2716e543d97 51 void debug_val (const char* label, u4_t val);
dudmuck 0:f2716e543d97 52
dudmuck 0:f2716e543d97 53 void debug_done(void);