LMiC does not receive Join Accept

Hi, I am trying my first node with my brand new Gateway :slight_smile:

I am using a dragino lora shield on a UNO with the standard lmic code (ttn-0taa.ino) from matthijskooijman.

I do see data coming in on the console every 60 secs but it has a different dev addr each time.
(looks like it keeps trying to register again and again?)
Arduino output only says packet queued and “EV_JOINING”.

Checked the APPEUI and DEVEUI multiple times, deleted the device and added it again. Created a new application but all no joy

When I try abp it woks right away

Any ideas?

Thx,
Jeroen

Is your device resetting between transmissions? The device should only list EV_JOINING once at startup, once it has joined and starts transmitting data not more joins should appear.

BTW adding output from the Arduino monitor to your question would help us see what is happening. (Use [code][/code] when including output.)

No, not resetting.

Only output on serial monitor is:

Starting
Packet queued
234: EV_JOINING

In console:

Well, starting what? Starting the node’s sketch from start? That’s what many would call a reset.

If your node is going into some deep sleep during which it loses its program state (memory contents) and after which it starts from scratch again, then it should somehow save the secrets, RX settings and frequencies it got through OTAA (or changes it got through ADR), and keep the last value of the uplink and downlink frame counters. LMiC does not provide anything to do that, but supports setting the known values after a reset, if you somehow saved them.

1 Like

The output comes only once. It is generated in the setup part:

void setup() {
    Serial.begin(115200);
    Serial.println(F("Starting"));

If the sketch resets I would see this scrolling multiple times and it does not.

No reset, no sleep, basic example used from arduino-lmic library (ttn-otaa.ino) only changed pins:

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 10,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 9,
    .dio = {2, 6, 7},
};

appeui:

static const u1_t PROGMEM APPEUI[8]={ 0x57, 0x1D, 0x00, 0xF0, 0x7E, 0xD5, 0xB3, 0x70 };

deveui:

static const u1_t PROGMEM DEVEUI[8]={ 0xE6, 0xC7, 0x2F, 0xE7, 0x4D, 0x3C, 0xB4, 0x00 };

and appkey:

static const u1_t PROGMEM APPKEY[16] = { 0xAE, 0x66, 0xB7, 0xE4, 0x9A, 0x3F, 0x38, 0x51, 0x65, 0x7B, 0x61, 0xF1, 0x8F, 0x27, 0xBB, 0xF4 };

did not change anything else

Ah, only now I see that the screenshot from TTN Console are not the incoming uplinks, but the outgoing OTAA Join Accepts. Apparently TTN is accepting the secrets in the Join Request (so that’s good) but your node is not getting the Join Accept, so this is false:

Make sure your gateway is sending the Join Accept, and see LMIC_setClockError.

2 Likes

Arjan, you are the best :smiley:

Adding this line to the “setup” part of sketch did the trick:

// Let LMIC compensate for +/- 1% clock error
    LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);

Thx!!

PS. How can I check if my gateway send the join accept? I checked the traffic tab in the console but not seeing any data

2 Likes

Make sure your have that page open before the Join Accept is sent. It might also go out through another gateway, if the Join Request was received by multiple gateways. See screenshots in Things Uno not joining anymore - #5 by arjanvanb.

I checked the gateway used in the package data so I knew it was using my own gateway.

But having the page open when joining works:

thx a lot!!!

PS. I made an issue on github for lmic, maybe he could add an #ifdef setting this clockerror tolerance for specific boards.