B-L072Z-LRWAN1 + LMIC + PlatformIO: compiling errors, board support

Hi,
And sorry if this a wrong place to ask such a question…

I’m taking the first steps to get B-L072Z-LRWAN1 connected to TTN. And also novice PlatformIO user, just switching from Arduino IDE.

I have B-L072Z-LRWAN1 defined in platformio.ini (below):

[env:disco_l072cz_lrwan1]
platform = ststm32
board = disco_l072cz_lrwan1
framework = arduino
lib_deps = mcci-catena/MCCI LoRaWAN LMIC library@^4.1.0

build_flags =

    ; Use platformio.ini for settings instead lmic_project_config.h.
    -D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
    ; Ping and beacons not supported for class A, disable to save memory.
    -D DISABLE_PING
    -D DISABLE_BEACONS
    -D CFG_sx1276_radio=1              ; Use for SX1276 radio
    -D USE_ORIGINAL_AES                ; Faster but larger, see docs
     -D CFG_eu868=1

But while compiling main.cpp I get “Unknow target” error.
image

Why is that?? I read that B-L072Z-LRWAN1 is supported and tested.

I copy-pasted main.cpp from LMIC-node library example in PlatformIO.

Also, why “do_send” error happens? Did I install the library wrong…?
image

Any help appreciated :slightly_smiling_face: Main.cpp is below.

/*******************************************************************************
 * Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
 * Copyright (c) 2018 Terry Moore, MCCI
 *
 * Permission is hereby granted, free of charge, to anyone
 * obtaining a copy of this document and accompanying files,
 * to do whatever they want with them without any restriction,
 * including, but not limited to, copying, modification and redistribution.
 * NO WARRANTY OF ANY KIND IS PROVIDED.
 *
 * This example sends a valid LoRaWAN packet with payload "Hello,
 * world!", using frequency and encryption settings matching those of
 * the The Things Network. It's pre-configured for the Adafruit
 * Feather M0 LoRa.
 *
 * This uses OTAA (Over-the-air activation), where where a DevEUI and
 * application key is configured, which are used in an over-the-air
 * activation procedure where a DevAddr and session keys are
 * assigned/generated for use with all further communication.
 *
 * Note: LoRaWAN per sub-band duty-cycle limitation is enforced (1% in
 * g1, 0.1% in g2), but not the TTN fair usage policy (which is probably
 * violated by this sketch when left running for longer)!

 * To use this sketch, first register your application and device with
 * the things network, to set or generate an AppEUI, DevEUI and AppKey.
 * Multiple devices can use the same AppEUI, but each device has its own
 * DevEUI and AppKey.
 *
 * Do not forget to define the radio type correctly in
 * arduino-lmic/project_config/lmic_project_config.h or from your BOARDS.txt.
 *
 *******************************************************************************/

#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>

//
// For normal use, we require that you edit the sketch to replace FILLMEIN
// with values assigned by the TTN console. However, for regression tests,
// we want to be able to compile these scripts. The regression tests define
// COMPILE_REGRESSION_TEST, and in that case we define FILLMEIN to a non-
// working but innocuous value.
//
#ifdef COMPILE_REGRESSION_TEST
# define FILLMEIN 0
#else
# warning "You must replace the values marked FILLMEIN with real values from the TTN control panel!"
# define FILLMEIN (#dont edit this, edit the lines that use FILLMEIN)
#endif

// This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70.
static const u1_t PROGMEM APPEUI[8]= { REMOVED };  
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);} 

// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]= { REMOVED };  
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);} 

// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from the TTN console can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { REMOVED }; 
void os_getDevKey (u1_t* buf) {  memcpy_P(buf, APPKEY, 16);}

static uint8_t mydata[] = "Hello, world!";
static osjob_t sendjob;

// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 180;

// Pin mapping
//
// Adafruit BSPs are not consistent -- m0 express defs ARDUINO_SAMD_FEATHER_M0,
// m0 defs ADAFRUIT_FEATHER_M0
//
#if defined(ARDUINO_SAMD_FEATHER_M0) || defined(ADAFRUIT_FEATHER_M0)
// Pin mapping for Adafruit Feather M0 LoRa, etc.
// /!\ By default Adafruit Feather M0's pin 6 and DIO1 are not connected.
// Please ensure they are connected.
const lmic_pinmap lmic_pins = {
    .nss = 8,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 4,
    .dio = {3, 6, LMIC_UNUSED_PIN},
    .rxtx_rx_active = 0,
    .rssi_cal = 8,              // LBT cal for the Adafruit Feather M0 LoRa, in dB
    .spi_freq = 8000000,
};
#elif defined(ARDUINO_AVR_FEATHER32U4)
// Pin mapping for Adafruit Feather 32u4 LoRa, etc.
// Just like Feather M0 LoRa, but uses SPI at 1MHz; and that's only
// because MCCI doesn't have a test board; probably higher frequencies
// will work.
// /!\ By default Feather 32u4's pin 6 and DIO1 are not connected. Please 
// ensure they are connected.
const lmic_pinmap lmic_pins = {
    .nss = 8,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 4,
    .dio = {7, 6, LMIC_UNUSED_PIN},
    .rxtx_rx_active = 0,
    .rssi_cal = 8,              // LBT cal for the Adafruit Feather 32U4 LoRa, in dB
    .spi_freq = 1000000,
};
#elif defined(ARDUINO_CATENA_4551)
// Pin mapping for Murata module / Catena 4551
const lmic_pinmap lmic_pins = {
        .nss = 7,
        .rxtx = 29,
        .rst = 8,
        .dio = { 25,    // DIO0 (IRQ) is D25
                 26,    // DIO1 is D26
                 27,    // DIO2 is D27
               },
        .rxtx_rx_active = 1,
        .rssi_cal = 10,
        .spi_freq = 8000000     // 8MHz
};
#else
# error "Unknown target"
#endif

void printHex2(unsigned v) {
    v &= 0xff;
    if (v < 16)
        Serial.print('0');
    Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
    Serial.print(os_getTime());
    Serial.print(": ");
    switch(ev) {
        case EV_SCAN_TIMEOUT:
            Serial.println(F("EV_SCAN_TIMEOUT"));
            break;
        case EV_BEACON_FOUND:
            Serial.println(F("EV_BEACON_FOUND"));
            break;
        case EV_BEACON_MISSED:
            Serial.println(F("EV_BEACON_MISSED"));
            break;
        case EV_BEACON_TRACKED:
            Serial.println(F("EV_BEACON_TRACKED"));
            break;
        case EV_JOINING:
            Serial.println(F("EV_JOINING"));
            break;
        case EV_JOINED:
            Serial.println(F("EV_JOINED"));
            {
              u4_t netid = 0;
              devaddr_t devaddr = 0;
              u1_t nwkKey[16];
              u1_t artKey[16];
              LMIC_getSessionKeys(&netid, &devaddr, nwkKey, artKey);
              Serial.print("netid: ");
              Serial.println(netid, DEC);
              Serial.print("devaddr: ");
              Serial.println(devaddr, HEX);
              Serial.print("AppSKey: ");
              for (size_t i=0; i<sizeof(artKey); ++i) {
                if (i != 0)
                  Serial.print("-");
                printHex2(artKey[i]);
              }
              Serial.println("");
              Serial.print("NwkSKey: ");
              for (size_t i=0; i<sizeof(nwkKey); ++i) {
                      if (i != 0)
                              Serial.print("-");
                      printHex2(nwkKey[i]);
              }
              Serial.println();
            }
            // Disable link check validation (automatically enabled
            // during join, but because slow data rates change max TX
	    // size, we don't use it in this example.
            LMIC_setLinkCheckMode(0);
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_RFU1:
        ||     Serial.println(F("EV_RFU1"));
        ||     break;
        */
        case EV_JOIN_FAILED:
            Serial.println(F("EV_JOIN_FAILED"));
            break;
        case EV_REJOIN_FAILED:
            Serial.println(F("EV_REJOIN_FAILED"));
            break;
            break;
        case EV_TXCOMPLETE:
            Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
            if (LMIC.txrxFlags & TXRX_ACK)
              Serial.println(F("Received ack"));
            if (LMIC.dataLen) {
              Serial.println(F("Received "));
              Serial.println(LMIC.dataLen);
              Serial.println(F(" bytes of payload"));
            }
            // Schedule next transmission
            os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
            break;
        case EV_LOST_TSYNC:
            Serial.println(F("EV_LOST_TSYNC"));
            break;
        case EV_RESET:
            Serial.println(F("EV_RESET"));
            break;
        case EV_RXCOMPLETE:
            // data received in ping slot
            Serial.println(F("EV_RXCOMPLETE"));
            break;
        case EV_LINK_DEAD:
            Serial.println(F("EV_LINK_DEAD"));
            break;
        case EV_LINK_ALIVE:
            Serial.println(F("EV_LINK_ALIVE"));
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_SCAN_FOUND:
        ||    Serial.println(F("EV_SCAN_FOUND"));
        ||    break;
        */
        case EV_TXSTART:
            Serial.println(F("EV_TXSTART"));
            break;
        case EV_TXCANCELED:
            Serial.println(F("EV_TXCANCELED"));
            break;
        case EV_RXSTART:
            /* do not print anything -- it wrecks timing */
            break;
        case EV_JOIN_TXCOMPLETE:
            Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
            break;

        default:
            Serial.print(F("Unknown event: "));
            Serial.println((unsigned) ev);
            break;
    }
}

void do_send(osjob_t* j){
    // Check if there is not a current TX/RX job running
    if (LMIC.opmode & OP_TXRXPEND) {
        Serial.println(F("OP_TXRXPEND, not sending"));
    } else {
        // Prepare upstream data transmission at the next possible time.
        LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
        Serial.println(F("Packet queued"));
    }
    // Next TX is scheduled after TX_COMPLETE event.
}

void setup() {
    delay(5000);
    while (! Serial)
        ;
    Serial.begin(9600);
    Serial.println(F("Starting"));

    #ifdef VCC_ENABLE
    // For Pinoccio Scout boards
    pinMode(VCC_ENABLE, OUTPUT);
    digitalWrite(VCC_ENABLE, HIGH);
    delay(1000);
    #endif

    // LMIC init
    os_init();
    // Reset the MAC state. Session and pending data transfers will be discarded.
    LMIC_reset();

    LMIC_setLinkCheckMode(0);
    LMIC_setDrTxpow(DR_SF7,14);
    LMIC_selectSubBand(1);

    // Start job (sending automatically starts OTAA too)
    do_send(&sendjob);
}

void loop() {
    os_runloop_once();
}

Looking at your code, ‘LMIC-node’ in the title referred to a node using the MCCI LMIC library. To prevent confusion I have updated the title.

There exists an example application named LMIC-node. It is also mentioned in MCCI LMIC’s README.md.

LMIC-node is more advanced than the examples included with the LMIC library and helps shortening the learning curve. LMIC-node supports the B-L072Z-LRWAN1 board and can help getting your board quickly up and running.

Thanks bluejedi!

Still couple of basic questions:

I installed LMIC-node via “New Terminal”: pio lib -g install https://github.com/lnlp/LMIC-node.gi t

Terminal response: Library Manager: LMIC-node @ 0.0.0+20211202095223.sha.38b1804 has been installed!

So everything should be fine. But platformio.ini looks like this in my project folder. So do I have to copy-paste manually the texts from github LMIC-node in section 4?

; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; Redirecting...
[env:disco_l072cz_lrwan1]
platform = ststm32
board = disco_l072cz_lrwan1
framework = arduino

Also, I can’t see “lorawan-keys.h” file or “lorawan-keys_example.h” file under “lib” or “include” folders. Do I need to create those manually?

Maybe I did LMIC-node installation wrong…?

Yes. :slightly_smiling_face:
LMIC-node is an application, not a library.
Above files are placed in the keyfiles folder, not in lib or include.

The preferred way to download LMIC-node (and other software on GitHub) is using git:

If not already installed on your computer: first install the git client software. Instructions for installing git can be found here: https://git-scm.com/download/

After having installed git:

  1. Open a terminal window (aka command prompt).
    If preferred you can also use a terminal window inside PlatformIO.

  2. Make the folder (aka directory) where you want to install LMIC-node your current folder.

  3. Then enter the command shown below. This will download all of LMIC-node and place it in a sub-folder named LMIC-node.

      git clone https://github.com/lnlp/LMIC-node
  1. Now open the LMIC-node folder in/with Visual Studio Code (with the PlatformIO extension already installed) and you’re ready to go.

I’ve done it via a GitHub clone, from the libraries manager in PIO and by downloading a ZIP but I’ve never tried that option - something to try out this coming holidays.

I’ve used LMIC-node with the B-L072Z board to good effect in the past, so it definitely works!

The instructions are probably the best you’ll find for pretty much anything on GitHub so are a highly recommended read, this link will take you straight to the correct section:

Thanks, bluejedi!

This clarified it. I got forward and LMIC is running on my custom node.

Some instability with JOIN: sometimes join works after few tries and sometime not at all… But I’m glad I got to this point and now I can debug.

1 Like

I’m still trying to debug OTAA JOIN problems. Out of 100 OTAA JOIN requests made, maybe 1 or 2 are successful. I guess good news is that sometimes it works…

Looks like other people have experienced this same issue and LMIC CLOCK ERROR have been suggested to be the reason.

This is what is said in board file bsf_disco_l072cz_lrwan1.h:

// LMIC Clock Error
// This is only needed for slower 8-bit MCUs (e.g. 8MHz ATmega328 and ATmega32u4).
// Value is defined in parts per million (of MAX_CLOCK_ERROR).
// Board appears to work better with clock error enabled (value 4000 empirically determined).

#ifndef LMIC_CLOCK_ERROR_PPM
#define LMIC_CLOCK_ERROR_PPM 4000
#endif

As disco_l072cz_lrwan1 has STM32 processor, I wonder why CLOCK ERROR is still defined as 4000?
I’ve been trying with with “LMIC_CLOCK_ERROR_PPM 0” but that doesn’t seem to help.

Is it likely that CLOCK ERROR plays any role in OTAA JOIN issue, or should I look from somewhere else for the reason?

Typical log file looks like this:

10:16:41.311 → LMIC-node
10:16:41.311 →
10:16:41.311 → Device-id: l072cz-lrwan1
10:16:41.311 → LMIC library: MCCI
10:16:41.311 → Activation: OTAA
10:16:41.311 → LMIC debug: 2
10:16:41.311 → Interval: 180 seconds
10:16:41.311 →
10:16:41.311 → RXMODE_RSSI
10:16:41.361 → Clock Error: 0 ppm (0)
10:16:41.361 → 000000097460: Event: EV_JOINING
10:16:41.361 → 97472: engineUpdate, opmode=0x4
10:16:41.361 →
10:16:41.361 → 000000097721: doWork job started
10:16:43.282 → 217094: engineUpdate, opmode=0x4
10:16:43.282 → 000000217169: Event: EV_TXSTART
10:16:43.282 → 217362: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0
10:16:48.330 → 532981: setupRx1 txrxFlags 00 → 01
10:16:48.330 → start single rx: now-rxtime: 12
10:16:48.330 → 533668: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
10:16:48.330 → rxtimeout: entry: 534147 rxtime: 533604 e
10:16:48.342 → ntry-rxtime: 543 now-entry: 13 rxtime-txend: 312375
10:16:49.330 → 595481: setupRx2 txrxFlags 0x1 → 02
10:16:49.330 → start single rx: now-rxtime: 12
10:16:49.330 → 596167: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
10:16:49.560 → rxtimeout: entry: 610483 rxtime: 596104 entry-rxtime: 14379 now-entry: 12 rxtime-txend: 374875
10:16:49.560 → 610868: processRx2Jacc txrxFlags 0x2 → 00
10:16:49.560 → 0000006109
10:16:49.582 → 62: Event: EV_JOIN_TXCOMPLETE
10:16:49.582 → 611175: engineUpdate, opmode=0x4
10:17:48.031 → 4266053: engineUpdate, opmode=0x4
10:17:48.031 → 000004266130: Event: EV_TXSTART
10:17:48.031 → 4266330: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0
10:17:53.081 → 4581950: setupRx1 txrxFlags 00 → 01
10:17:53.081 → start single rx: now-rxtime: 12
10:17:53.081 → 4582637: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
10:17:53.081 → rxtimeout: entry: 4583119 rxtime: 4582574 entry-rxtime: 545 now
10:17:53.100 → -entry: 13 rxtime-txend: 312375
10:17:54.080 → 4644450: setupRx2 txrxFlags 0x1 → 02
10:17:54.080 → start single rx: now-rxtime: 12
10:17:54.080 → 4645137: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
10:17:54.311 → rxtimeout: entry: 4659455 rxtime: 4645074 entry-rxtime: 14381 now-entry: 12 rxtime-txend: 374875
10:17:54.311 → 4659750: processRx2Jacc txrxFlags 0x2 → 00
10:17:54.311 → 000004659964: Event: EV_JOIN_TXCOMPLETE
10:17:54.311 → 46
10:17:54.327 → 60346: engineUpdate, opmode=0x4
10:18:58.282 → 8660009: engineUpdate, opmode=0x4
10:18:58.282 → 000008660086: Event: EV_TXSTART
10:18:58.282 → 8660279: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
10:19:03.339 → 8975896: setupRx1 txrxFlags 00 → 01
10:19:03.339 → start single rx: now-rxtime: 12
10:19:03.339 → 8976582: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
10:19:03.339 → rxtimeout: entry: 8977064 rxtime: 8976520 entry-rxtime: 544 now-e
10:19:03.371 → ntry: 14 rxtime-txend: 312375
10:19:04.341 → 9038396: setupRx2 txrxFlags 0x1 → 02
10:19:04.341 → start single rx: now-rxtime: 12
10:19:04.341 → 9039083: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
10:19:04.574 → rxtimeout: entry: 9053387 rxtime: 9039020 entry-rxtime: 14367 now-entry: 12 rxtime-txend: 374875
10:19:04.574 → 9053846: processRx2Jacc txrxFlags 0x2 → 00
10:19:04.574 → 000009053922: Event: EV_JOIN_TXCOMPLETE
10:19:04.574 → 9054218: engineUpdate, opmode=0x4

I can see "JoinRequest "in NS and NS sends out “JoinAccept”.

Thanks!

EDIT: Just adding here a log of successful JOIN I just got:

13:16:21.012 → LMIC-node
13:16:21.012 →
13:16:21.012 → Device-id: l072cz-lrwan1
13:16:21.012 → LMIC library: MCCI
13:16:21.012 → Activation: OTAA
13:16:21.012 → LMIC debug: 2
13:16:21.012 → Interval: 180 seconds
13:16:21.012 →
13:16:21.012 → RXMODE_RSSI
13:16:21.081 → Clock Error: 4000 ppm (262)
13:16:21.081 → 000000097773: Event: EV_JOINING
13:16:21.081 → 97841: engineUpdate, opmode=0x4
13:16:21.081 →
13:16:21.081 → 000000098039: doWork job started
13:16:21.390 → 117833: engineUpdate, opmode=0x4
13:16:21.390 → 000000117908: Event: EV_TXSTART
13:16:21.390 → 118100: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
13:16:26.420 → 432471: setupRx1 txrxFlags 00 → 01
13:16:26.420 → start single rx: now-rxtime: 12
13:16:26.420 → 433158: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
13:16:26.480 → rxtimeout: entry: 436138 rxtime: 433095 entry-rxtime: 3043 now-entry: 12 rxtime-txend: 311126
13:16:27.418 → 494722: setupRx2 txrxFlags 0x1 → 02
13:16:27.418 → start single rx: now-rxtime: 12
13:16:27.418 → 495408: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
13:16:27.691 → rxtimeout: entry: 511768 rxtime: 495345 entry-rxtime: 16423 now-entry: 12 rxtime-txend: 373376
13:16:27.691 → 512121: processRx2Jacc txrxFlags 0x2 → 00
13:16:27.691 → 000000512257: Event: EV_JOIN_TXCOMPLETE
13:16:27.691 → 512673: engineUpdate, opmode=0x4
13:17:31.370 → 4494814: engineUpdate, opmode=0x4
13:17:31.370 → 000004494891: Event: EV_TXSTART
13:17:31.370 → 4495091: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0
13:17:36.402 → 4809460: setupRx1 txrxFlags 00 → 01
13:17:36.402 → start single rx: now-rxtime: 12
13:17:36.402 → 4810146: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
13:17:36.450 → rxtimeout: entry: 4813124 rxtime: 4810083 entry-rxtime: 3041 now-entry: 12 rxtime-txend: 311126
13:17:37.401 → 4871709: setupRx2 txrxFlags 0x1 → 02
13:17:37.401 → start single rx: now-rxtime: 12
13:17:37.401 → 4872397: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
13:17:37.671 → rxtimeout: entry: 4888757 rxtime: 4872333 entry-rxtime: 16424 now-entry: 12 rxtime-txend: 373376
13:17:37.671 → 4889014: processRx2Jacc txrxFlags 0x2 → 00
13:17:37.671 → 000004889276: Event: EV_JOIN_TXCOMPLETE
13:17:37.671 → 4889650: engineUpdate, opmode=0x4
13:18:39.062 → 8727844: engineUpdate, opmode=0x4
13:18:39.062 → 000008727922: Event: EV_TXSTART
13:18:39.062 → 8728113: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0
13:18:44.090 → 9042482: setupRx1 txrxFlags 00 → 01
13:18:44.090 → start single rx: now-rxtime: 12
13:18:44.090 → 9043169: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
13:18:44.137 → rxtimeout: entry: 9046147 rxtime: 9043106 entry-rxtime: 3041 now-entry: 12 rxtime-txend: 311126
13:18:45.079 → 9104733: setupRx2 txrxFlags 0x1 → 02
13:18:45.079 → start single rx: now-rxtime: 12
13:18:45.079 → 9105418: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
13:18:45.358 → rxtimeout: entry: 9121775 rxtime: 9105356 entry-rxtime: 16419 now-entry: 12 rxtime-txend: 373376
13:18:45.358 → 9122082: processRx2Jacc txrxFlags 0x2 → 00
13:18:45.358 → 000009122389: Event: EV_JOIN_TXCOMPLETE
13:18:45.358 → 9122563: engineUpdate, opmode=0x4
13:19:20.970 →
13:19:20.970 → 000011348040: doWork job started
13:19:50.781 → 13212366: engineUpdate, opmode=0x4
13:19:50.781 → 000013212446: Event: EV_TXSTART
13:19:50.781 → 13212637: TXMODE, freq=868100000, len=23, SF=8, BW=125, CR=4/5, IH=0
13:19:55.871 → 13530224: setupRx1 txrxFlags 00 → 01
13:19:55.871 → start single rx: now-rxtime: 12
13:19:55.871 → 13530909: RXMODE_SINGLE, freq=868100000, SF=8, BW=125, CR=4/5, IH=0
13:19:55.938 → rxtimeout: entry: 13534337 rxtime: 13530847 entry-rxtime: 3490 now-entry: 12 rxtime-txend: 311126
13:19:56.862 → 13592473: setupRx2 txrxFlags 0x1 → 02
13:19:56.862 → start single rx: now-rxtime: 12
13:19:56.862 → 13593160: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
13:19:57.141 → rxtimeout: entry: 13609522 rxtime: 13593097 entry-rxtime: 16425 now-entry: 12 rxtime-txend: 373376
13:19:57.141 → 13609965: processRx2Jacc txrxFlags 0x2 → 00
13:19:57.141 → 000013610097: Event: EV_JOIN_TXCOMPLETE
13:19:57.141 → 13610294: engineUpdate, opmode=0x4
13:21:49.410 → 20632398: engineUpdate, opmode=0x4
13:21:49.410 → 000020632477: Event: EV_TXSTART
13:21:49.410 → 20632675: TXMODE, freq=868500000, len=23, SF=8, BW=125, CR=4/5, IH=0
13:21:54.480 → 20950267: setupRx1 txrxFlags 00 → 01
13:21:54.480 → start single rx: now-rxtime: 12
13:21:54.480 → 20950953: RXMODE_SINGLE, freq=868500000, SF=8, BW=125, CR=4/5, IH=0
13:21:54.660 → 20961100: Setup channel, idx=3, freq=867100000
13:21:54.660 → 20961180: Setup channel, idx=4, freq=867300000
13:21:54.660 → 20961542: Setup channel, idx=5, freq=866800000
13:21:54.660 → 20961621: Setup channel, idx=6, freq=867700000
13:21:54.660 → 20961939: Setup channel, idx=7, freq=867900000
13:21:54.660 → 000020962167: Event: EV_JOINED
13:21:54.672 → Network Id: 6291457
13:21:54.672 → Device Address: E0038A9D
13:21:54.672 → Application Session Key: 00-36-D9-8C-F1-E8-AC-DA-FE-65-ED-FE-FF-91-4E-24
13:21:54.683 → Network Session Key: AE-5F-32-3A-D3-8F-DE-9D-87-51-F1-B2-8C-77-6E-34
13:21:54.705 → 20963697: engineUpdate, opmode=0x800
13:21:54.705 →
13:21:54.705 → 000020963895: doWork job started
13:21:54.761 → 000020967125: Input data collected
13:21:54.761 → COUNTER value: 1
13:21:54.761 → 000020967336: Packet queued
13:21:54.761 → 20967347: engineUpdate, opmode=0x808
13:21:54.761 → 000020967746: Event: EV_TXSTART
13:21:54.761 → 20968007: TXMODE, freq=868300000, len=15, SF=8, BW=125, CR=4/5, IH=0
13:21:55.840 → 21035317: setupRx1 txrxFlags 0x1 → 01
13:21:55.840 → start single rx: now-rxtime: 12
13:21:55.840 → 21036004: RXMODE_SINGLE, freq=868300000, SF=10, BW=125, CR=4/5, IH=0
13:21:55.919 → rxtimeout: entry: 21040073 rxtime: 21035941 entry-rxtime: 4132 now-entry: 12 rxtime-txend: 62126
13:21:56.841 → 21097568: setupRx2 txrxFlags 0x1 → 02
13:21:56.841 → start single rx: now-rxtime: 11
13:21:56.841 → 21098253: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
13:21:56.910 → rxtimeout: entry: 21101041 rxtime: 21098191 entry-rxtime: 2850 now-entry: 12 rxtime-txend: 124376
13:21:56.910 → 21101538: processRx2DnData txrxFlags 0x2 → 00
13:21:56.910 → 21101617: processDnData_norx txrxFlags 00 → 20
13:21:56.910 → 000021101852: Event: EV_TXCOMPLETE
13:21:56.910 → Up: 1, Down: 0
13:21:56.910 → 21102233: engineUpdate, opmode=0x900
13:24:54.530 →

You seem to have modified some code in LMIC-node because LMIC-node normally outputs os_time and not time in hh:mm:ss format.
Start with unmodified code first and only make modifications after you have the basics succesfully working (which is not yet).

Are you using a true LoRaWAN complaint gateway?

I have not modified LMIC-node code. The time stamp before arrow mark comes from CoolTerm.

There’s no TTN gateway in my area and didn’t get mine yet. So for now I’m testing with LoRaWAN network operated by local teleoperator. I believe it’s LoRaWAN complaint: it’s been working fine with my earlier Arduino SAMD21 LoRaWAN node.

Looking at the log files from NS I think I figured out what is the issue:

  • LMIC-node sends “JoinRequest” always on “SubBand” G1 on “Channel” LC1, LC2 or LC3. Gateway responds with “JoinAccept” typically on “SubBand” G3 on “Channel” LC255. LMIC-node doesn’t seem to get these “JoinAccept” messages.
  • Only after multiple “JoinRequests” (and quite randomly) gateway sends “JoinAccept” on G1/LC3 after LMIC-node has sent “JoinRequest” on G1/LC3. When this happens LMIC-node “gets” “JoinAccept” sent by the gateway.

Below is one example. “JoinAccept” sent by the gateway on green row gets accepted by LMIC-node.
image

Does this after all mean that the gateway is not LoRaWAN complaint?

Can I do something for this in LMIC-node?

Thanks again for helping on this!

Ah, that explains it. FYI: PlatformIO also has a built in serial monitor that you can use.

So the NS is from some other operator? (or the operator must route its traffic to TTN via Packet Broker). This forum is for The Things Network (only), not for other operator’s LoRaWAN networks.

This forum is for The Things Network (only), not for other operator’s LoRaWAN networks.

Understood. The idea is to setup my own TTN gateway; as there’s no TTN gateways in my area.

Meanwhile, can I ask this newbie question? Node HW wise the next step would be to make my own PCB using Murata CMWX1ZZABZ module (used also in B-L072Z-LRWAN1). How would I program CMWX1ZZABZ directly from Platformio? Do I need special tools?

Another thing: Is LMIC-node somehow geared towards being used with TTN?

If you know a better place to ask these questions, can you please let me know?

Thanks!

Good luck finding any of the modules.

And to be brutally honest, if you need to ask how to setup programming the module from PlatformIO using the special tools, then perhaps you need to travel the LoRaWAN journey a bit more before making a PCB. Short answer is to use the very same programmer that’s already on the B-L072Z board which is an ST-Link.

It works out of the box with TTN. There does exist a fork of LMIC-node that targets use with Helium.