CH2I ULP node library open source!

Yes, since recently as this appears to be the one that is still maintained and contains several improvements/fixes (compared to GitHub - matthijskooijman/arduino-lmic: ⚠ This library is deprecated, see the README for alternatives.). It also provides support for more regions/ISM band frequencies so your code can be used by more people around the globe.

Also see: Overview of LoRaWAN Libraries [HowTo]

Correct. ‘MCCI LoRaWAN LMIC library’ defines CFG_us915=1 as default in configuration file lmic_project_config.h which is very probably the cause for not working out of the box.

I.m.o. MCCI LoRaWAN LMIC library should not set any default region frequency because this is error prone while the user is unaware of the cause. Instead the user should explicitly have to select this (without a default) and a compilation error should be given if not done yet.

lmic_project_config.h defines project scoped settings at library sourcecode level instead of project level. Changing settings in lmic_project_config.h requires modification of library sourcecode which is maintenance intensive, error prone and difficult to automate.
A serious problem with this construct is that changes made to lmic_project_config.h will be silently overwritten with every library update. Luckily when using PlatformIO we can do these settings in platformio.ini which is not impacted by library updates.

The MCCI LoRaWAN LMIC library supports a build flag to suppress the use of lmic_project_config.h.
This build flag makes possible to define library build options in platformio.ini instead of lmic_project_config.h.

Example platformio.ini with support for MCCI LoRaWAN LMIC library:

; File: platformio.ini

[env:lora32u4II]
platform = atmelavr
board = lora32u4II
framework = arduino

monitor_speed = 115200

lib_deps =
    MCCI LoRaWAN LMIC library

build_flags =
    ; *** LMIC library build options: ***
    ; -D DISABLE_PING
    ; -D DISABLE_BEACONS
    ; -D LMIC_DEBUG_LEVEL=2
    ; -D LMIC_PRINTF_TO=Serial 	
    ; *** MCCI LoRaWAN LMIC library specific build options: ***
    ; Set suppress flag to suppress lmic_project_config.h
    ; to allow project related settings to be defined here instead.
    -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
    ; -D CFG_in866=1
    -D CFG_eu868=1
    ; -D CFG_us915=1
    ; -D CFG_au921=1
    ; -D CFG_as923=1
    ; -D LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP   ; for as923-JP
    -D CFG_sx1276_radio=1
    ; -D LMIC_USE_INTERRUPTS    

Note: The recently released PlatformIO Core 4.0 has introduced directory structure changes. You may possibly have to update projects after upgrading to Core 4.0 (e.g. deleting .piolibdeps directory).

2 Likes