# LMiC does not receive Join Accept

**URL:** <https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079>\
**Category:** LMIC\
**Created:** [March 8, 2018, 7:59pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079 "2018-03-08T19:59:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![I-Connect](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/i-connect/32/20484_2.png) [@I-Connect](https://www.thethingsnetwork.org/forum/u/I-Connect)\
**Post date:** [March 8, 2018, 7:59pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/1 "2018-03-08T19:59:13Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![kersing](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kersing/32/44777_2.png) [@kersing](https://www.thethingsnetwork.org/forum/u/kersing)\
**Post date:** [March 9, 2018, 10:16am UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/2 "2018-03-09T10:16:35Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![I-Connect](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/i-connect/32/20484_2.png) [@I-Connect](https://www.thethingsnetwork.org/forum/u/I-Connect)\
**Post date:** [March 10, 2018, 1:40pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/3 "2018-03-10T13:40:10Z")

</div>

No, not resetting.

Only output on serial monitor is:

```auto
Starting
Packet queued
234: EV_JOINING
```

In console:  
 ![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/7/7e45219b11dc0fd753d8ae6d91a9ac14201d9cc7.png)

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [March 10, 2018, 2:04pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/4 "2018-03-10T14:04:27Z")

</div>

> [@I-Connect](#):
>
> Only output on serial monitor is:
> 
> ```plaintext
> Starting
> ...
> 
> ```

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](https://www.thethingsnetwork.org/forum/t/otaa-then-abp/12377/5).

---

<div class="post-metadata">

**Author:** ![I-Connect](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/i-connect/32/20484_2.png) [@I-Connect](https://www.thethingsnetwork.org/forum/u/I-Connect)\
**Post date:** [March 10, 2018, 2:30pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/5 "2018-03-10T14:30:44Z")

</div>

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

```auto
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:

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

appeui:

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

deveui:

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

and appkey:

```auto
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

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [March 10, 2018, 2:42pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/6 "2018-03-10T14:42:57Z")

</div>

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:

> [@I-Connect](#):
>
> I do see data coming in on the console

Make sure your gateway is sending the Join Accept, and see [LMIC\_setClockError](https://www.thethingsnetwork.org/forum/search?q=LMIC_setClockError).

---

<div class="post-metadata">

**Author:** ![I-Connect](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/i-connect/32/20484_2.png) [@I-Connect](https://www.thethingsnetwork.org/forum/u/I-Connect)\
**Post date:** [March 10, 2018, 3:01pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/7 "2018-03-10T15:01:05Z")

</div>

Arjan, you are the best 😃

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

```auto
// 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

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [March 10, 2018, 3:31pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/8 "2018-03-10T15:31:24Z")

</div>

> [@I-Connect](#):
>
> traffic tab in the console but not seeing any data

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](https://www.thethingsnetwork.org/forum/t/things-uno-not-joining-anymore/12772/5).

---

<div class="post-metadata">

**Author:** ![I-Connect](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/i-connect/32/20484_2.png) [@I-Connect](https://www.thethingsnetwork.org/forum/u/I-Connect)\
**Post date:** [March 10, 2018, 4:02pm UTC](https://www.thethingsnetwork.org/forum/t/lmic-does-not-receive-join-accept/13079/9 "2018-03-10T16:02:55Z")

</div>

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:

![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/b/b9660b4602e2c6a9f30631b92b70ca8e67ebe236.png)

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.
