Heltec Wifi LoRa v2 compilation error due to missing constant declaration

Hi @all

I am new to all this LoRa Stuff. At first I want to build a ttnmapper like shown on
https://github.com/noppingen/Lora-TTNMapper-Heltec-v2 and https://github.com/sistemasorp/Heltec-Wifi-Lora-32-TTN-Mapper

I have allready installed

Libraries:
-MCCI LoRaWAN LMIC library by IBM, Matthias Kooijman, Terry Morre, ChaeHee Won, Frank Rose Version 3.2.0

  • u8g2 from oliver Version 2.27.6
  • TinyGPS++

But when I try to compile the scatch, different errors are popping up that some defines are not declared:

In file included from /home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/arduino_lmic.h:26:0,
from /home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/lmic.h:28,
from /home/rush/Arduino/sketch_aug20a/sketch_aug20a.ino:27:
/home/rush/Arduino/sketch_aug20a/sketch_aug20a.ino: In function ‘void setup()’:
sketch_aug20a:435:48: error: ‘DR_SF12’ was not declared in this scope
LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
^
/home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/lmic/lmic.h:653:50: note: in definition of macro ‘DR_RANGE_MAP’
#define DR_RANGE_MAP(drlo,drhi) (((u2_t)0xFFFF<<(drlo)) & ((u2_t)0xFFFF>>(15-(drhi))))
^
sketch_aug20a:435:67: error: ‘BAND_CENTI’ was not declared in this scope
LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
^
In file included from /home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/arduino_lmic.h:26:0,
from /home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/lmic.h:28,
from /home/rush/Arduino/sketch_aug20a/sketch_aug20a.ino:27:
sketch_aug20a:436:57: error: ‘DR_SF7B’ was not declared in this scope
LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
^
/home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/lmic/lmic.h:653:79: note: in definition of macro ‘DR_RANGE_MAP’
#define DR_RANGE_MAP(drlo,drhi) (((u2_t)0xFFFF<<(drlo)) & ((u2_t)0xFFFF>>(15-(drhi))))
^
sketch_aug20a:443:48: error: ‘DR_FSK’ was not declared in this scope
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band
^
/home/rush/Arduino/libraries/MCCI_LoRaWAN_LMIC_library/src/lmic/lmic.h:653:50: note: in definition of macro ‘DR_RANGE_MAP’
#define DR_RANGE_MAP(drlo,drhi) (((u2_t)0xFFFF<<(drlo)) & ((u2_t)0xFFFF>>(15-(drhi))))
^
sketch_aug20a:443:67: error: ‘BAND_MILLI’ was not declared in this scope
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band
^
Mehrere Bibliotheken wurden für “WiFi.h” gefunden
Benutzt: /home/rush/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
Nicht benutzt: /home/rush/Downloads/arduino-1.8.13/libraries/WiFi
exit status 1
‘DR_SF12’ was not declared in this scope


When I comment the lines:
LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band

The scetch will compile and is working, I mean… the GPS, OLED. But I can not see any data coming in on the ttn-console.

The module itself seems to send something because the scatch is programmed to tell the user via Display what is going on. I thing, without the LMIC_setupChannel command, the modules sends not on the desired 868 Mhz and thus nothing is received. Right?

But whats wrong with the library ??? I spend almost lots of hours but cound not get any step further.

Who can help me?

Btw: I also changed the keys for my application. Just for completeness :wink:

Kind regards

If you’re using the Arduino IDE: did you change the configuration in Arduino/libraries/MCCI_LoRaWAN_LMIC_library/project_config/lmic_project_config.h ?

There is no folder named “project-config” nor the file “lmic_project_config.h”

Yes, there is, not in your own code but in the library’s folder. (Which is horrible, but like documented: The Arduino environment doesn’t give us a better way to do this, unless you change BOARDS.txt.)

See also https://github.com/mcci-catena/arduino-lmic#configuration

Oh sorry, had to step up one more folder :wink:

Thank you very much! I havent seen this file before. I read about it, but could not find it since I searched in the src-folde r :roll_eyes:

Hope the rest will be working too :slight_smile:

After adjusting the lmic_project_config, Did you manage to get it to connect and send to the ttn network or did you do something more?

This is an ancient thread so closing