Skip to content

Commit 59f1a1a

Browse files
authored
Merge pull request #412 from mcci-catena/issue388a
Fix remaining failures in US V1.0.2 compliance
2 parents 7eaa4c3 + 9e6872c commit 59f1a1a

25 files changed

+441
-164
lines changed

HOWTO-ADD-REGION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ At time of writing, you need to duplicate some code to copy some settings from `
7676
```console
7777
lmic.c:29: In file included from
7878

79-
lmic_bandplan.h: 52:3: error: #error "maxFrameLen() not defined by bandplan"
80-
# error "maxFrameLen() not defined by bandplan"
79+
lmic_bandplan.h: 52:3: error: #error "LMICbandplan_maxFrameLen() not defined by bandplan"
80+
# error "LMICbandplan_maxFrameLen() not defined by bandplan"
8181

8282
lmic_bandplan.h: 56:3: error: #error "pow2dBm() not defined by bandplan"
8383
# error "pow2dBm() not defined by bandplan"

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ requires C99 mode to be enabled by default.
3636
- [Features](#features)
3737
- [Additional Documentation](#additional-documentation)
3838
- [PDF/Word Documentation](#pdfword-documentation)
39-
- [Adding Bandplans](#adding-bandplans)
39+
- [Adding Regions](#adding-regions)
4040
- [Known bugs and issues](#known-bugs-and-issues)
4141
- [Configuration](#configuration)
4242
- [Selecting the LoRaWAN Region Configuration](#selecting-the-lorawan-region-configuration)
@@ -144,7 +144,7 @@ us know (creating a GitHub issue is probably the best way for that).
144144

145145
The `doc` directory contains [LMiC-v2.3.pdf](doc/LMiC-v2.3.pdf), which documents the library APIs and use. It's based on the original IBM documentation, but has been adapted for this version of the library. However, as this library is used for more than Arduino, that document is supplemented by practical details in this document.
146146

147-
### Adding Bandplans
147+
### Adding Regions
148148

149149
There is a general framework for adding new region support. [HOWTO-ADD-REGION.md](./HOWTO-ADD-REGION.md) has step-by-step instructions for adding a region.
150150

@@ -656,7 +656,7 @@ This library provides several examples.
656656
OTAA is the preferred way to work with production LoRaWAN networks.
657657
658658
- [`ttn-otaa-feather-us915.ino`](examples/ttn-otaa-feather-us915/ttn-otaa-feather-us915.ino) is a version of `ttn-otaa.ino` that has
659-
been configured for use with the Feather M0 LoRa, on the US915 band plan,
659+
been configured for use with the Feather M0 LoRa, in the US915 region,
660660
with The Things Network. Remember that you may also have to change `config.h`
661661
from defaults. This sketch also works with the MCCI Catena family of products
662662
as well as with the Feather 32u4 LoRa.
@@ -691,7 +691,7 @@ This library provides several examples.
691691
[Catena-Arduino-Platform](https://github.com/mcci-catena/Catena-Arduino-Platform).
692692
693693
- [`ttn-abp-feather-us915-dht22.ino`](examples/ttn-abp-feather-us915-dht22/ttn-abp-feather-us915-dht22.ino)
694-
refines `ttn-abp.ino` by configuring for use with the Feather M0 LoRa on the US915 band plan,
694+
refines `ttn-abp.ino` by configuring for use with the Feather M0 LoRa in the US915 region,
695695
with a single-channel gateway on The Things Network; it measures and transmits temperature and relative
696696
humidity using a DHT22 sensor. It's only been tested with Feather M0-family products.
697697
@@ -1096,11 +1096,14 @@ function uflt12f(rawUflt12)
10961096

10971097
## Release History
10981098

1099-
- HEAD adds the following changes.
1099+
- HEAD adds the following changes (this is not an exhaustive list)
11001100

1101+
- [#388](https://github.com/mcci-catena/arduino-lmic/issues/388), [#389](https://github.com/mcci-catena/arduino-lmic/issues/390), [#390](https://github.com/mcci-catena/arduino-lmic/issues/390) change the LMIC to honor the maximum frame size for a given DR in the current region. This proves to be a breaking change for many applications, especially in the US, because DR0 in the US supports only an 11-byte payload, and many apps were ignoring this. Additional error codes were defined so that apps can detect and recover from this situation, but they must detect; otherwise they run the risk of being blocked from the network by the LMIC. Because of this change, the next version of the LMIC will be V3.1 or higher, and the LMIC version for development is bumped to 3.0.99.0.
1102+
- [#401](https://github.com/mcci-catena/arduino-lmic/issues/401) adds 865 MHz through 868 MHz to the "1%" band for EU.
1103+
- [#395]((https://github.com/mcci-catena/arduino-lmic/pull/395) corrects pin-mode initialization if using `hal_interrupt_init()`.
11011104
- [#385](https://github.com/mcci-catena/arduino-lmic/issues/385) corrects an error handling data rate selection for `TxParamSetupReq`, found in US-915 certification testing. (v2.3.2.71)
11021105
- [#378](https://github.com/mcci-catena/arduino-lmic/pull/378) completely reworks MAC downlink handling. Resulting code passes the LoRaWAN V1.5 EU certification test. (v2.3.2.70)
1103-
- [#360](https://github.com/mcci-catena/arduino-lmic/pull/360) adds support for the KR-920 regional plan.
1106+
- [#360](https://github.com/mcci-catena/arduino-lmic/issues/360) adds support for the KR-920 regional plan.
11041107

11051108
- v2.3.2 is a patch release. It incorporates two pull requests.
11061109

@@ -1139,7 +1142,7 @@ function uflt12f(rawUflt12)
11391142

11401143
- V2.1.0 adds support for the Murata LoRaWAN module.
11411144

1142-
- V2.0.2 adds support for the extended band plans.
1145+
- V2.0.2 adds support for additional regions.
11431146

11441147
## Contributions
11451148

@@ -1149,7 +1152,7 @@ This library started from the IBM V1.5 open-source code.
11491152

11501153
- Terry Moore, LeRoy Leslie, Frank Rose, and ChaeHee Won did a lot of work on US support.
11511154

1152-
- Terry Moore added the AU921, AS923 and IN866 band plans, and created the regionalization framework.
1155+
- Terry Moore added the AU921, AS923, KR920 and IN866 regions, and created the regionalization framework, and did corrections for LoRaWAN 1.0.3 compliance testing.
11531156

11541157
- [`@tanupoo`](https://github.com/tanupoo) of the WIDE Project debugged AS923JP and LBT support.
11551158

doc/LMIC-v2.3.docx

-86.3 KB
Binary file not shown.

doc/LMIC-v2.3.pdf

-458 KB
Binary file not shown.

doc/LMIC-v3.0.99.docx

96.8 KB
Binary file not shown.

doc/LMIC-v3.0.99.pdf

510 KB
Binary file not shown.

examples/compliance-otaa-halconfig/compliance-otaa-halconfig.ino

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,21 @@ Author:
2929

3030
// This EUI must be in little-endian format, so least-significant-byte
3131
// first. This corresponds to 0x0000000000000001
32-
static const u1_t PROGMEM APPEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
33-
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
32+
// static const u1_t PROGMEM APPEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
33+
void os_getArtEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
3434

3535
// This should also be in little endian format, see above.
3636
// This corresponds to 0x0000000000000001
37-
static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
38-
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}
37+
// static const u1_t PROGMEM DEVEUI[8]= { 1, 0, 0, 0, 0, 0, 0, 0 };
38+
void os_getDevEui (u1_t* buf) { memset(buf, 0, 8); buf[0] = 1; }
3939

4040
// This key should be in big endian format (or, since it is not really a
4141
// number but a block of memory, endianness does not really apply).
42-
static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
43-
void os_getDevKey (u1_t* buf) { memcpy_P(buf, APPKEY, 16);}
42+
// static const u1_t PROGMEM APPKEY[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
43+
void os_getDevKey (u1_t* buf) { memset(buf, 0, 16); buf[15] = 2; }
4444

45-
static uint8_t mydata[] = "Hello, world!";
45+
// this data must be kept short -- max is 11 bytes for US DR0
46+
static uint8_t mydata[] = { 0xCA, 0xFE, 0xF0, 0x0D };
4647
static osjob_t sendjob;
4748

4849
// Schedule TX every this many seconds (might become longer due to duty
@@ -540,7 +541,7 @@ void do_send(osjob_t* j){
540541
Serial.println(F("test mode, not sending"));
541542
} else {
542543
// Prepare upstream data transmission at the next possible time.
543-
if (LMIC_sendWithCallback(1, mydata, sizeof(mydata)-1, 0, sendComplete, j) == 0) {
544+
if (LMIC_sendWithCallback_strict(1, mydata, sizeof(mydata), 0, sendComplete, j) == 0) {
544545
Serial.println(F("Packet queued"));
545546
} else {
546547
Serial.println(F("Packet queue failure; sleeping"));
@@ -579,6 +580,18 @@ void myFail(const char *pMessage) {
579580
}
580581
}
581582

583+
// there's a problem with running 2.5 of the MCCI STM32 BSPs;
584+
// hack around it.
585+
#ifdef ARDUINO_ARCH_STM32
586+
# ifdef _mcci_arduino_version
587+
# if _mcci_arduino_version <= _mcci_arduino_version_calc(2, 5, 0, 0)
588+
uint32_t USBD_LL_ConnectionState(void) {
589+
return 1;
590+
}
591+
# endif // _mcci_arduino_version
592+
# endif // defined(_mcci_arduino_version)
593+
#endif // ARDUINO_ARCH_STM32
594+
582595
void setup() {
583596
delay(5000);
584597
while (! Serial)

0 commit comments

Comments
 (0)