Skip to content

Commit bea07c1

Browse files
Upgrade LMIC library to version 1.5
This adds the "lmic" and "doc" directories from lmic-release-v1.5.zip as downloaded from IBM. The other directories ("stm32" containing the HAL for stm32 boards and "examples", containing plain C examples) are left out. All text files were converted to unix line endings and had trailing whitespace stripped, so it's easier for git to handle them. dos2unix src/lmic/* doc/*.txt sed -i 's/\s*$//' src/lmic/* doc/*.txt
1 parent c6e177c commit bea07c1

File tree

5 files changed

+38
-19
lines changed

5 files changed

+38
-19
lines changed
Binary file not shown.

doc/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DISCLAIMER:
2+
Please note that the software is provided AS IS and we cannot
3+
provide support for optimizations, adaptations, integration,
4+
ports to other platforms or device drivers!

doc/release-notes.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ LMIC VERSION 1.4 (17-Mar-2015)
1414
- fixed timer rollover handling in job queue
1515

1616
==============================================================================
17+
LMIC VERSION 1.5 (8-May-2015)
18+
------------------------------
19+
20+
- fixed condition in convFreq()
21+
22+
- fixed freq*100 bug and freq==0 bug for CFList
23+
24+
- fixed TX scheduling bug
25+
26+
- better support for GNU compiler toolchain
27+
28+
==============================================================================

src/lmic/lmic.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,6 @@ ostime_t calcAirTime (rps_t rps, u1_t plen) {
315315
return (((ostime_t)tmp << sfx) * OSTICKS_PER_SEC + div/2) / div;
316316
}
317317

318-
extern inline s1_t rssi2s1 (int v);
319-
extern inline int s12rssi (s1_t v);
320-
extern inline float s12snr (s1_t v);
321-
extern inline s1_t snr2s1 (double v);
322-
323318
extern inline rps_t updr2rps (dr_t dr);
324319
extern inline rps_t dndr2rps (dr_t dr);
325320
extern inline int isFasterDR (dr_t dr1, dr_t dr2);
@@ -612,7 +607,7 @@ void LMIC_disableChannel (u1_t channel) {
612607

613608
static u4_t convFreq (xref2u1_t ptr) {
614609
u4_t freq = (os_rlsbf4(ptr-1) >> 8) * 100;
615-
if( freq >= EU868_FREQ_MIN && freq <= EU868_FREQ_MAX )
610+
if( freq < EU868_FREQ_MIN || freq > EU868_FREQ_MAX )
616611
freq = 0;
617612
return freq;
618613
}
@@ -741,7 +736,7 @@ static void initDefaultChannels (void) {
741736

742737
static u4_t convFreq (xref2u1_t ptr) {
743738
u4_t freq = (os_rlsbf4(ptr-1) >> 8) * 100;
744-
if( freq >= US915_FREQ_MIN && freq <= US915_FREQ_MAX )
739+
if( freq < US915_FREQ_MIN || freq > US915_FREQ_MAX )
745740
freq = 0;
746741
return freq;
747742
}
@@ -1375,14 +1370,15 @@ static bit_t processJoinAccept (void) {
13751370
initDefaultChannels(0);
13761371
#endif
13771372
if( dlen > LEN_JA ) {
1378-
dlen = OFF_CFLIST;
1379-
#if defined(CFG_eu868)
1380-
u1_t chidx=3;
1381-
#elif defined(CFG_us915)
1382-
u1_t chidx=72;
1373+
#if defined(CFG_us915)
1374+
goto badframe;
13831375
#endif
1384-
for( ; chidx<8; chidx++, dlen+=3 )
1385-
LMIC_setupChannel(chidx, os_rlsbf4(&LMIC.frame[dlen-1]) >> 8, 0, -1);
1376+
dlen = OFF_CFLIST;
1377+
for( u1_t chidx=3; chidx<8; chidx++, dlen+=3 ) {
1378+
u4_t freq = convFreq(&LMIC.frame[dlen]);
1379+
if( freq )
1380+
LMIC_setupChannel(chidx, freq, 0, -1);
1381+
}
13861382
}
13871383

13881384
// already incremented when JOIN REQ got sent off
@@ -1543,7 +1539,7 @@ static void buildDataFrame (void) {
15431539
}
15441540
if( LMIC.snchAns ) {
15451541
LMIC.frame[end+0] = MCMD_SNCH_ANS;
1546-
LMIC.frame[end+1] = LMIC.snchAns;
1542+
LMIC.frame[end+1] = LMIC.snchAns & ~MCMD_SNCH_ANS_RFU;
15471543
end += 2;
15481544
LMIC.snchAns = 0;
15491545
}
@@ -1929,6 +1925,7 @@ static void engineUpdate (void) {
19291925
// Earliest possible time vs overhead to setup radio
19301926
if( txbeg - (now + TX_RAMPUP) < 0 ) {
19311927
// We could send right now!
1928+
txbeg = now;
19321929
dr_t txdr = (dr_t)LMIC.datarate;
19331930
if( jacc ) {
19341931
u1_t ftype;
@@ -2155,6 +2152,12 @@ void LMIC_setSession (u4_t netid, devaddr_t devaddr, xref2u1_t nwkKey, xref2u1_t
21552152
LMIC.opmode &= ~(OP_JOINING|OP_TRACK|OP_REJOIN|OP_TXRXPEND|OP_PINGINI);
21562153
LMIC.opmode |= OP_NEXTCHNL;
21572154
stateJustJoined();
2155+
DO_DEVDB(LMIC.netid, netid);
2156+
DO_DEVDB(LMIC.devaddr, devaddr);
2157+
DO_DEVDB(LMIC.nwkKey, nwkkey);
2158+
DO_DEVDB(LMIC.artKey, artkey);
2159+
DO_DEVDB(LMIC.seqnoUp, seqnoUp);
2160+
DO_DEVDB(LMIC.seqnoDn, seqnoDn);
21582161
}
21592162

21602163
// Enable/disable link check validation.

src/lmic/lmic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020

2121
// LMIC version
2222
#define LMIC_VERSION_MAJOR 1
23-
#define LMIC_VERSION_MINOR 4
24-
#define LMIC_VERSION_BUILD 1426605786
23+
#define LMIC_VERSION_MINOR 5
24+
#define LMIC_VERSION_BUILD 1431528305
2525

2626
enum { MAX_FRAME_LEN = 64 }; //!< Library cap on max frame length
2727
enum { TXCONF_ATTEMPTS = 8 }; //!< Transmit attempts for confirmed frames
2828
enum { MAX_MISSED_BCNS = 20 }; // threshold for triggering rejoin requests
2929
enum { MAX_RXSYMS = 100 }; // stop tracking beacon beyond this
3030

31-
enum { LINK_CHECK_CONT = 6 , // continue with this after reported dead link
32-
LINK_CHECK_DEAD = 12 , // after this UP frames and no response from NWK assume link is dead
31+
enum { LINK_CHECK_CONT = 12 , // continue with this after reported dead link
32+
LINK_CHECK_DEAD = 24 , // after this UP frames and no response from NWK assume link is dead
3333
LINK_CHECK_INIT = -12 , // UP frame count until we inc datarate
3434
LINK_CHECK_OFF =-128 }; // link check disabled
3535

0 commit comments

Comments
 (0)