# CH2I ULP node library open source!

**URL:** <https://www.thethingsnetwork.org/forum/t/ch2i-ulp-node-library-open-source/28016>\
**Category:** LMIC\
**Created:** [July 12, 2019, 9:07am UTC](https://www.thethingsnetwork.org/forum/t/ch2i-ulp-node-library-open-source/28016 "2019-07-12T09:07:01Z")\
**Posts on this page:** 1\
**Showing post:** 48

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [July 17, 2019, 10:37am UTC](https://www.thethingsnetwork.org/forum/t/ch2i-ulp-node-library-open-source/28016/48 "2019-07-17T10:37:49Z")

</div>

> [@Charles](#):
>
> Do you use this lib?

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.](https://github.com/matthijskooijman/arduino-lmic)). 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]](https://www.thethingsnetwork.org/forum/t/overview-of-lorawan-libraries-lmic-loramac-node-and-their-variations/24692)

> [@Charles](#):
>
> but changing to catena does not work right out of the box on my code,

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:

```cpp
; 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)._

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/ch2i-ulp-node-library-open-source/28016)._
