LMIC for MOTE_L152RC
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_HYBRID | 125KHz | 500KHz |
---|---|---|
defined value | channels | channel |
0 | 0 to 7 | 64 |
1 | 8 to 15 | 65 |
2 | 16 to 23 | 66 |
3 | 24 to 31 | 67 |
4 | 32 to 39 | 68 |
5 | 40 to 47 | 69 |
6 | 48 to 55 | 70 |
7 | 56 to 63 | 71 |
undef | 0 to 63 | 64 to 71 |
Revision 10:6c0830baf10f, committed 2015-12-04
- Comitter:
- dudmuck
- Date:
- Fri Dec 04 01:05:11 2015 +0000
- Parent:
- 9:83ae7f34e88c
- Commit message:
- correct DR4 channel used in 8ch mode. added JOIN_SINGLE_CHANNEL_BLOCK option for faster joining in 8ch mode.
Changed in this revision
lmic.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/lmic.cpp Mon Nov 16 23:52:45 2015 +0000 +++ b/lmic.cpp Fri Dec 04 01:05:11 2015 +0000 @@ -861,7 +861,7 @@ if( LMIC.datarate >= DR_SF8C ) { // 500kHz #ifdef CHNL_HYBRID - LMIC.txChnl = 1 << CHNL_HYBRID; // only one channel possible + LMIC.txChnl = CHNL_HYBRID + 64; // only one channel possible #else en_cnt = count_bits(LMIC.channelMap[4]); do { @@ -942,7 +942,7 @@ setDrJoin(DRCHG_SET, DR_SF7); } -static ostime_t nextJoinState (void) { +static ostime_t nextJoinState (void) { // us915 u1_t failed = 0; #if 0 @@ -967,11 +967,16 @@ if( LMIC.datarate == DR_SF8C ) { // attempted 500khz channel, try 125khz channel in next block LMIC.datarate = DR_SF10; +#ifdef JOIN_SINGLE_CHANNEL_BLOCK + if (++LMIC.joinBlockChnl == 8) + LMIC.joinBlockChnl = 0; +#else if (++LMIC.joinBlock == 8) { LMIC.joinBlock = 0; if (++LMIC.joinBlockChnl == 8) LMIC.joinBlockChnl = 0; } +#endif /* !JOIN_SINGLE_CHANNEL_BLOCK */ LMIC.txChnl = (LMIC.joinBlock << 3) + LMIC.joinBlockChnl; } else { // attempted 125khz channel, try 500khz channel @@ -1385,7 +1390,8 @@ static void schedRx2 (ostime_t delay, osjobcb_t func) { // Add 1.5 symbols we need 5 out of 8. Try to sync 1.5 symbols into the preamble. - LMIC.rxtime = LMIC.txend + delay + (PAMBL_SYMS-MINRX_SYMS)*dr2hsym(LMIC.dn2Dr); + LMIC.rxtime = LMIC.txend + delay + /* PAMBL_SYMS-MINRX_SYMS)* */ dr2hsym(LMIC.dn2Dr); + LMIC.rxtime -= us2osticks(4); os_setTimedCallback(&LMIC.osjob, LMIC.rxtime - RX_RAMPUP, func); } @@ -1418,7 +1424,7 @@ else #endif { - LMIC.rxtime = LMIC.txend + delay + (PAMBL_SYMS-MINRX_SYMS)*dr2hsym(LMIC.dndr); + LMIC.rxtime = LMIC.txend + delay + (PAMBL_SYMS-MINRX_SYMS) * dr2hsym(LMIC.dndr); LMIC.rxsyms = MINRX_SYMS; } os_setTimedCallback(&LMIC.osjob, LMIC.rxtime - RX_RAMPUP, func);