# Over-the-air-activation OTAA with LMIC

**URL:** <https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921>\
**Category:** End Devices (Nodes)\
**Created:** [April 23, 2016, 9:34pm UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921 "2016-04-23T21:34:08Z")\
**Posts on this page:** 5\
**Page:** 5

<div class="post-metadata">

**Author:** ![jezd](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jezd/32/46461_2.png) [@jezd](https://www.thethingsnetwork.org/forum/u/jezd)\
**Post date:** [January 25, 2019, 12:26am UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921/83 "2019-01-25T00:26:05Z")

</div>

given your code seems to look generic how are you restricting your device frequency to match your single channel gateway?

---

<div class="post-metadata">

**Author:** ![ChristosSKG](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/christosskg/32/20484_2.png) [@ChristosSKG](https://www.thethingsnetwork.org/forum/u/ChristosSKG)\
**Post date:** [January 25, 2019, 6:35pm UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921/84 "2019-01-25T18:35:17Z")

</div>

I am using the [tftelkamp/single\_chan\_pkt\_fwd](https://github.com/tftelkamp/single_chan_pkt_fwd) library for the gateway. And if downlinks are essential for OTAA to work then that explains it, because it is quite clear in the [Read.me](http://Read.me) file that downlinks are not yet supported.

So, taking this into consideration, could you please suggest me another library for a simple Raspberry Pi single channel gateway?

Also, where could I read more details on how ABP and OTAA work under the hood?

---

<div class="post-metadata">

**Author:** ![ChristosSKG](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/christosskg/32/20484_2.png) [@ChristosSKG](https://www.thethingsnetwork.org/forum/u/ChristosSKG)\
**Post date:** [January 25, 2019, 7:06pm UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921/85 "2019-01-25T19:06:31Z")

</div>

Thank you for the answer! Well, I am not sure if that is enough, but I am doing the following.  
Is there anything else I should pay attention to?

In gateway:

> // Set spreading factor (SF7 - SF12)  
> sf\_t sf = SF7;  
> // Set center frequency  
> uint32\_t freq = 868100000; // in Mhz! (868.1)

In node (at least in the ABP version):

> LMIC\_setupChannel(0, 868100000, DR\_RANGE\_MAP(DR\_SF12, DR\_SF7), BAND\_CENTI); // g-band  
> // While keeping the rest of frequencies commented out.

---

<div class="post-metadata">

**Author:** ![jezd](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jezd/32/46461_2.png) [@jezd](https://www.thethingsnetwork.org/forum/u/jezd)\
**Post date:** [January 25, 2019, 8:32pm UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921/86 "2019-01-25T20:32:38Z")

</div>

Check out this thread :[Can LMIC 1.6 be set up to use a single channel and SF?](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/11)

The issue at the end of the day is that none of these libraries have been written with single channel gateways in mind, fighting against the tide 🙂

I would fall back to [https://github.com/matthijskooijman/arduino-lmic](https://github.com/matthijskooijman/arduino-lmic) library first and prove the ABP code is doing what 100% it should, check uploads, downloads, acknowledgments etc, then turn to the OTAA example code (not the same as ABP) - check out the examples. Be careful you are starting from the example code supplied from its library too.

MCCI lmic library seems to extend some functionality - but I would not use first, this library caught me out on the config file for a day or so, it seems to work fine now - default is set to USA frequencies etc.

---

<div class="post-metadata">

**Author:** ![UdLoRa](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/udlora/32/45330_2.png) [@UdLoRa](https://www.thethingsnetwork.org/forum/u/UdLoRa)\
**Post date:** [January 26, 2019, 7:09am UTC](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921/87 "2019-01-26T07:09:09Z")

</div>

Check [this fork](https://github.com/bokse001/dual_chan_pkt_fwd) of the single channel software, with the mods described [here](https://www.thethingsnetwork.org/forum/t/dual-chan-gateway-with-raspberry-pi3-dragino-hat-v1-4-and-downstream-messages/13284). Not necessarily you solve everything, but at least downlinks are supported. And receiving downlinks could also be problematic on the node (some slow platform need [clock error relaxation](https://www.thethingsnetwork.org/forum/search?q=LMiC%20MAX_CLOCK_ERROR)).

[Previous page](https://www.thethingsnetwork.org/forum/t/over-the-air-activation-otaa-with-lmic/1921.md?page=4)
