# Can LMIC 1.6 be set up to use a single channel and SF?

**URL:** <https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207>\
**Category:** End Devices (Nodes)\
**Created:** [February 4, 2017, 10:43am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207 "2017-02-04T10:43:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![wklenk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/wklenk/32/44682_2.png) [@wklenk](https://www.thethingsnetwork.org/forum/u/wklenk)\
**Post date:** [February 4, 2017, 10:43am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/1 "2017-02-04T10:43:39Z")

</div>

Setup:

- Raspberry Pi 3
- Dragino LoRa/GPS HAT
- LMIC 1.6 protocol stack from [https://www.research.ibm.com/labs/zurich/ics/lrsc/lmic.html](https://www.research.ibm.com/labs/zurich/ics/lrsc/lmic.html)
- Own HAL implementation
- Single Channel Gateway based on [https://github.com/tftelkamp/single\_chan\_pkt\_fwd](https://github.com/tftelkamp/single_chan_pkt_fwd)

Problem is, that the Single Channel Gateway is listening at SF7 on 868.100000 Mhz, but during the “join” procedure the LMIC 1.6 protocol stack randomly chooses a channel (-\> RF frequency) and has an algorithm that tries out the different spreading factors.

So there is the situation that the receiver (Single Channel Gateway) listens on **one** particular channel (frequency) with **one** particular spreading factor (SF7), but the transmitter sends on randomly chosen channels and spreading factors.

Okay, maybe it “works as designed”, but the question is:

**Is there an (easy) way to tell the LMIC 1.6 protocol stack to stick to one channel and a predefined spreading factor?**

---

<div class="post-metadata">

**Author:** ![wklenk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/wklenk/32/44682_2.png) [@wklenk](https://www.thethingsnetwork.org/forum/u/wklenk)\
**Post date:** [February 5, 2017, 5:27pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/2 "2017-02-05T17:27:27Z")

</div>

This is only valid for LMIC 1.6 sourcecode. I haven’t looked at the 1.5 version.  
In file lmic/lmic.c you find the following function:

```
static void initJoinLoop (void) {
#if CFG_TxContinuousMode
  LMIC.txChnl = 0;
#else
    LMIC.txChnl = os_getRndU1() % 6; // Do NOT remove this line
    LMIC.txChnl = 0; // Add this line to avoid random choice of TX channel
#endif
    LMIC.adrTxPow = 14;
    setDrJoin(DRCHG_SET, DR_SF7);
    initDefaultChannels(1);
    ASSERT((LMIC.opmode & OP_NEXTCHNL)==0);
    LMIC.txend = LMIC.bands[BAND_MILLI].avail + rndDelay(8);
}

```

Don’t try to be too clever and remove the line containing `_os_getRndU1()_`. I did it and it did not work any longer. Probably there are other things going on behind the curtain than just creating a simple 1 byte random number.

If you do this modification you should be aware that you may violate the LoRaWAN specification and possibly regulations of your country. I recommend only to do it for testing, not for production.

---

<div class="post-metadata">

**Author:** ![mogyoros](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mogyoros/32/25844_2.png) [@mogyoros](https://www.thethingsnetwork.org/forum/u/mogyoros)\
**Post date:** [April 15, 2017, 8:54am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/3 "2017-04-15T08:54:24Z")

</div>

Hi there!  
I am using LMIC 1.5. Looking for the same answers as you… 🙂  
Found a way to lock join frequencies to a single channel by setting CH0,1,2 to the same frequency.

To fix the spreading factor: in lmic.c, in initJoinLoop modify

`// setDrJoin(DRCHG_SET, DR_SF7); setDrJoin(DRCHG_SET, LMIC.datarate);`

In the main code use:  
`LMIC.datarate=DR_SFx` - where x stands for the SF use want to use

To avoid SF hopping during join: in lmic.c, modify nextJoinState:  
`// setDrJoin(DRCHG_NOJACC, decDR((dr_t)LMIC.datarate)); setDrJoin(DRCHG_NOJACC, (dr_t)LMIC.datarate);`

So it wont try to decrease the SF when previous join failed.  
Cheers

---

<div class="post-metadata">

**Author:** ![itacos](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/i/b4bc9f/32.png) [@itacos](https://www.thethingsnetwork.org/forum/u/itacos)\
**Post date:** [April 15, 2017, 9:07am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/4 "2017-04-15T09:07:37Z")

</div>

Hello,

I am using LMIC 1.5 but on arduino and I use this function `LMIC_setupChannel` to limit channel settings and comment all other channels :

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

```

It seems to work for me with the `single_chan_pkt_fwd` , I just have a problem with packet loss (3 packet lost between 2 successful send …)

I hope it can help you.

Bye

---

<div class="post-metadata">

**Author:** ![mogyoros](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mogyoros/32/25844_2.png) [@mogyoros](https://www.thethingsnetwork.org/forum/u/mogyoros)\
**Post date:** [April 15, 2017, 12:07pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/5 "2017-04-15T12:07:33Z")

</div>

Hi @itacos !

You are seeing the packet loss, beacuse in that case the node is trying to use the other base channels (frequencies: 868.3 & 868.5 MHz). Which you can’t disable using the lmic lib in this manner. I faced this issue aswell.  
The only way is to modify the base channels/frequencies in the lib (lorabase.h, EU868\_F2&F3).

For the rest of channels/frequencies (3-8) you probably can manipulate this using LMIC\_setupChannel command.

We all now that this could violate the frequency usage (1%), and is not lorawan compliant, so shall careful doing so!

---

<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:** [April 15, 2017, 12:12pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/6 "2017-04-15T12:12:25Z")

</div>

> [@mogyoros](#):
>
> the other base channels (frequencies: 868.3 & 868.5 MHz). Which you can’t disable using the lmic lib in this manner.

⚠ **Any packet forwarder that is not a full gateway is harmful to other users of The Things Network, and should not be used if there is even a small chance that other TTN users are in your wide area neighbourhood. So, the following solution is probably _not_ what you need, and is only appropriate if you know what you’re doing.**

> **I understand, show me the code.**
>
> > **Really, I understand, show me the code.**
> >
> > > **Really, even though I could not come up with the answer myself, I really do understand this is likely to harm others, so show me the code.**
> > >
> > > For LMiC 1.5 `LMIC_disableChannel(number)` worked for me, for ABP, even for the default channels. Don’t know for 1.6 though.
> > > 
> > > (⚠ See also [my extended answer further below](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/11).)
> > > 
> > > Somewhere after `LMIC_setupChannel` for ABP, and probably _also_ after `EV_JOINED` for OTAA:
> > > 
> > > ```
> > > // Define the single channel and data rate (SF) to use
> > > int channel = 0;
> > > int dr = DR_SF7;
> > > 
> > > // Disable all channels, except for the one defined above. 
> > > // FOR TESTING ONLY!
> > > for(int i=0; i<9; i++) { // For EU; for US use i<71
> > > if(i != channel) {
> > > LMIC_disableChannel(i);
> > > }
> > > }
> > > 
> > > // Set data rate (SF) and transmit power for uplink
> > > LMIC_setDrTxpow(dr, 14);
> > > 
> > > ```

---

<div class="post-metadata">

**Author:** ![mogyoros](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mogyoros/32/25844_2.png) [@mogyoros](https://www.thethingsnetwork.org/forum/u/mogyoros)\
**Post date:** [April 15, 2017, 6:53pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/7 "2017-04-15T18:53:51Z")

</div>

Hi Arjan!  
I fully trust you, but I could not manage to do it that way. I spent days to read forums and the lib to figure it out, but I could not find the reason. (using a Nano+RFM95)  
Hence I wrote a small addition to the lib, so I can set the base frequencies with a downstream package, and store them in EEPROM. When unit boots up, reads up these values for base channels stored in eeprom, and sets them to use during operation. With that I can keep the flexibility to modify anytime back to the original channel settings, and be later lorawan compliant, and use the node with lorawan gateways.  
Cheers

---

<div class="post-metadata">

**Author:** ![itacos](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/i/b4bc9f/32.png) [@itacos](https://www.thethingsnetwork.org/forum/u/itacos)\
**Post date:** [April 16, 2017, 6:32am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/8 "2017-04-16T06:32:59Z")

</div>

Hi @arjanvanb and @mogyoros,

Thanks for advices, I have tested @arjanvanb solution and it works for me too in ABP mode with the LMiC 1.5 but don’t know if it works for 1.6.

---

<div class="post-metadata">

**Author:** ![mogyoros](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mogyoros/32/25844_2.png) [@mogyoros](https://www.thethingsnetwork.org/forum/u/mogyoros)\
**Post date:** [April 16, 2017, 7:22pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/9 "2017-04-16T19:22:21Z")

</div>

Hi Arjan!  
I gave it an another chance to make it work as you wrote, but no luck. During join it still tries all 3 base frequencies.  
Maybe beacuse I am using OTAA? I will try to look into deeper tomorrow…  
My code (examples/ttn-otaa):

> ```
> void setup() {
> Serial.begin(115200);
> 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();
> int channel = 0;
> int dr = DR_SF7;
> for(int i=0; i<9; i++) { // For EU; for US use i<71
> if(i != channel) {
> LMIC_disableChannel(i);
> }
> }
> LMIC_setDrTxpow(dr, 14);
> // Start job (sending automatically starts OTAA too)
> do_send(&sendjob);
> 
> ```
> 
> }

Console output:

> Starting  
> RXMODE\_RSSI  
> 401: engineUpdate, opmode=0x808  
> Packet queued  
> 568: EV\_JOINING  
> 613: engineUpdate, opmode=0xc  
> 63718: engineUpdate, opmode=0xc  
> 64407: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0  
> 380736: RXMODE\_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0  
> 446212: RXMODE\_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0  
> 456355: engineUpdate, opmode=0xc  
> 921139: engineUpdate, opmode=0xc  
> 921832: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0  
> 1238289: RXMODE\_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0  
> 1303765: RXMODE\_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0  
> 1313908: engineUpdate, opmode=0xc  
> 1817924: engineUpdate, opmode=0xc  
> 1818620: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0  
> 2134950: RXMODE\_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0  
> 2200426: RXMODE\_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0  
> 2210570: engineUpdate, opmode=0xc  
> 2495607: engineUpdate, opmode=0xc

And so on… As you can see It uses all 3 base channels during **OTAA** join.  
Cheers

---

<div class="post-metadata">

**Author:** ![mogyoros](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mogyoros/32/25844_2.png) [@mogyoros](https://www.thethingsnetwork.org/forum/u/mogyoros)\
**Post date:** [April 17, 2017, 9:14am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/10 "2017-04-17T09:14:28Z")

</div>

Confirmed. Works fine when using ABP. So the library definately handles this function differently when using OTAA.  
Cheers

---

<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:** [April 17, 2017, 1:27pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/11 "2017-04-17T13:27:38Z")

</div>

⚠ **Any packet forwarder that is not a full gateway is harmful to other users of The Things Network, and should not be used if there is even a small chance that other TTN users are in your wide area neighbourhood. So, the following solution is probably _not_ what you need, and is only appropriate if you know what you’re doing.**

> **I understand, show me the code.**
>
> > **Really, I understand, show me the code.**
> >
> > > **Really, even though I could not come up with the answer myself, I really do understand this is likely to harm others, but I still need the code.**
> > >
> > > For 1.5, if one does not want to change the library, here is how one can make an ABP or OTAA sketch work with a single channel gateway and [Matthijs Kooijman’s LMiC](https://github.com/matthijskooijman/arduino-lmic/):
> > > 
> > > - Somewhere above `onEvent` define:
> > > 
> > > - For ABP, [in `init()` replace `LMIC_setDrTxpow(DR_SF7,14);`](https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-abp/ttn-abp.ino) with:
> > > 
> > > - For OTAA, [in `init()` after `LMIC_reset();`](https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-otaa/ttn-otaa.ino) add:
> > > 
> > > - For OTAA, for `EV_JOINED` in `onEvent` use:
> > > 
> > > But note:
> > > 
> > > - Only tested with LMiC 1.5, for EU868, channel 0.
> > > 
> > > - For OTAA this assumes the first attempt succeeds; if the Join Request or Join Accept are somehow lost, LMiC will still try different channels and data rates due to the logic in `nextJoinState`
> > > 
> > > - Only tested with an OTAA Join Accept received in RX1 (for EU868 using the same channel as the uplink/join request); when received in RX2 (for EU868 [always using 869.525 on SF9](https://www.thethingsnetwork.org/wiki/LoRaWAN/Frequencies/Frequency-Plans#lorawan-frequencies_eu863-870)), LMiC might also use other values to send? (But maybe the `LMIC_setDrTxpow(dr, 14)` suffices.)
> > > 
> > > ### Background
> > > 
> > > For Matthijs’ LMiC 1.5, the OTAA flow is:
> > > 
> > > - [In `examples/ttn-otaa/ttn-otaa.ino`](https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-otaa/ttn-otaa.ino), calling `LMIC_reset` clears the keys after which `LMIC_setTxData2` is called to schedule some data to be sent.
> > > 
> > > - [In `src/lmic.c`](https://github.com/matthijskooijman/arduino-lmic/blob/master/src/lmic/lmic.c), `engineUpdate` controls the flow, like if something has been scheduled for transmission. When `LMIC.devaddr == 0` this will first trigger `LMIC_startJoining`:
> > > 
> > > - Whenever a join attempt fails, `nextJoinState` will select another channel and/or data rate (SF), without checking if the channel is activated; see [https://github.com/matthijskooijman/arduino-lmic/issues/88](https://github.com/matthijskooijman/arduino-lmic/issues/88). One cannot change that behavior from one’s own sketch.

---

<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 1, 2018, 6:39am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/12 "2018-03-01T06:39:26Z")

</div>

For the US, which uses 64 channels while gateways might only use 8 (or one, for a single-channel gateway), the following **from April 2016** might be relevant:

> [@Node with ESP8266 and RFM95W](https://www.thethingsnetwork.org/forum/t/node-with-esp8266-and-rfm95w/1002/53):
>
> Huh, turns out the lmic.cpp LMIC\_disableChannel(u1\_t channel) for CFG\_us915 I got from [LoRa-Thing/libraries/lmic-v1.5 at master · things4u/LoRa-Thing · GitHub](https://github.com/things4u/LoRa-Thing/tree/master/libraries/lmic-v1.5) is broken - for
> 
> ```cpp
> struct lmic_t {
> #elif defined(CFG_us915)
> u2_t channelMap[(72+MAX_XCHANNELS+15)/16]; // enabled bits
> 
> ```
> 
> that should be an array of 5 16 bit values (80 bits, to cover 74 total channels), which when initialized is:
> 
> ```cpp
> LMIC.channelMap[0] = 0xFFFF 16
> LMIC.channelMap[1] = 0xFFFF 32
> LMIC.channelMap[2] = 0xFFFF 48
> LMIC.channelMap[3] = 0xFFFF 64
> LMIC.channelMap[4] = 0x00FF 72 bits
> 
> ```
> 
> However, LMIC\_disableChannel() for CFG\_us915 is modulo 4???
> 
> ```cpp
> LMIC.channelMap[channel/4] &= ~(1<<(channel&0xF));
> 
> ```
> 
> should be 16. As it is, when you disable channel 4, you actually get 20!
> 
> ```plaintext
> 4: channelMap[0]: ffff  
> channelMap[1]: ffef 1110 1111 wtf??
> 
> ```
> 
> LMIC\_disableChannel(8) turns off the bit for 40, etc. Changed it to:
> 
> ```cpp
> LMIC.channelMap[channel/16] &= ~(1<<(channel&0xF));
> 
> ```

And:

> [@Node with ESP8266 and RFM95W](https://www.thethingsnetwork.org/forum/t/node-with-esp8266-and-rfm95w/1002/56):
>
> [https://github.com/matthijskooijman/arduino-lmic/blob/master/src/lmic/lmic.c](https://github.com/matthijskooijman/arduino-lmic/blob/master/src/lmic/lmic.c)
> 
> has the same bug:
> 
> ```cpp
> void LMIC_disableChannel (u1_t channel) {
> if( channel < 72+MAX_XCHANNELS )
> LMIC.channelMap[channel/4] &= ~(1<<(channel&0xF));      
> }
> 
> ```
> 
> That 4 should be a 16 to get the right byte of the array - only affects CFG\_us915

I’ve not validated, but someone might want to create a pull request if this bug is currently still in the code

---

<div class="post-metadata">

**Author:** ![aayk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/aayk/32/25844_2.png) [@aayk](https://www.thethingsnetwork.org/forum/u/aayk)\
**Post date:** [March 14, 2018, 10:50pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/13 "2018-03-14T22:50:42Z")

</div>

Thank you very much! Now my node is sending uplinks in a single channel in US \_915

---

<div class="post-metadata">

**Author:** ![vjbmario](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/v/fbc32d/32.png) [@vjbmario](https://www.thethingsnetwork.org/forum/u/vjbmario)\
**Post date:** [March 27, 2018, 12:11am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/14 "2018-03-27T00:11:49Z")

</div>

Hello Guys,

First of all thank you so much for the information. I am really new in this world, and I am trying to build the complete system, LoraWan Gateway (Raspberry Pi 3B + Lora Shield v1.4) and a device (arduino nano connected to Lora RFM95).

I have already did the systems with help of this 2 tutorials:

- [https://www.mobilefish.com/developer/lorawan/lorawan\_quickguide\_build\_lora\_node\_rfm95\_arduino\_uno.html](https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_build_lora_node_rfm95_arduino_uno.html)
- [https://www.mobilefish.com/developer/lorawan/lorawan\_quickguide\_build\_lora\_gateway.html](https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_build_lora_gateway.html)

And after I edit my code as arjanvanb explain to have transmission single channel… What is very strange for me is that I can always receive the transmission in LoraWan Gateway but after when I see in ttn site in data, sometimes the addr is wrong, as can be seen in the picture… Anyone understands ![2018-03-27_01-00-51](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/0/05d5f1a57aa3dcf71615ee778a93a22a3ddca14f.png) why?

Thank you so much and I hope you could help me 🙂

Best regards,  
Valter Mário

---

<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 27, 2018, 4:17am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/15 "2018-03-27T04:17:46Z")

</div>

Why do you think the DevAddr is wrong? Which one do you expect?

Seems to me that your gateway is simply also receiving LoRa (or LoRaWAN) packets from other devices, which are not yours. That is to be expected, as the gateway radio receiver just listens and forwards to TTN, which will ignore the packets when from unknown devices. (A TTN DevAddr always starts with hexadecimal 26 or 27.)

---

<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 27, 2018, 6:34am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/16 "2018-03-27T06:34:33Z")

</div>

> [@vjbmario](#):
>
> sometimes the addr is wrong, as can be seen in the picture

Looks like you are also forwarding packets with CRC errors. If so, please disable that.  
While testing make sure to keep at least 3 meter between the node and the gateway.

---

<div class="post-metadata">

**Author:** ![vjbmario](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/v/fbc32d/32.png) [@vjbmario](https://www.thethingsnetwork.org/forum/u/vjbmario)\
**Post date:** [March 27, 2018, 9:54am UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/17 "2018-03-27T09:54:59Z")

</div>

Wow! Today when I woke up I took my system into working again but this time with Gateway 3 meters away and apparently it’s working perfect!

Since I had the opportunity to talk with you, I would like ask another thing to you: Apparently, my gateway only support uplink. Do you know some API or another way of doing it support Downlink with this hardware (Raspberry Pi 3 + Lora Shield)?

Thank you so much for your advice, it’s amazing have a community that answer so fast!

Thank you so much!

---

<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 27, 2018, 8:50pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/18 "2018-03-27T20:50:35Z")

</div>

Have you checked [DRAGINO problems and solutions topic](https://www.thethingsnetwork.org/forum/t/dragino-problems-and-solutions-topic/8951/62) for downlink enabled RPi setup?

---

<div class="post-metadata">

**Author:** ![bauvill](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/b/71c47a/32.png) [@bauvill](https://www.thethingsnetwork.org/forum/u/bauvill)\
**Post date:** [June 3, 2018, 9:45pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/19 "2018-06-03T21:45:51Z")

</div>

Hi Wklenk,  
Thanks for your posts and supports.  
I have some few questions.  
1-The single channel gateway you pointed in this link ( [https://github.com/tftelkamp/single\_chan\_pkt\_fwd](https://github.com/tftelkamp/single_chan_pkt_fwd) ) does not support downlinks so can the gateway send downlinks ??  
2- I have a LoRaWan end device that runs the LMIC v.16 ( from your git repo), I can send data with it but I can’t receive any and I honestly have hard times understanding the code.  
I would like to know if the is a version of the code that supports ABP since it is the only authentification supported by single channel gateway. I have to spend too much time trying to make it work, please help if you can Thanks.  
**Note** : my end device and my gateway are based on RPI+LoRa GPS HAT.

---

<div class="post-metadata">

**Author:** ![wklenk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/wklenk/32/44682_2.png) [@wklenk](https://www.thethingsnetwork.org/forum/u/wklenk)\
**Post date:** [June 4, 2018, 3:32pm UTC](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207/20 "2018-06-04T15:32:06Z")

</div>

The code supports ABP, but there is no example how to do it.

You can check the example given here:

> <https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-abp/ttn-abp.ino>

The important lines are these:

```
// LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the early prototype TTN
// network.
static const PROGMEM u1_t NWKSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

// LoRaWAN AppSKey, application session key
// This is the default Semtech key, which is used by the early prototype TTN
// network.
static const u1_t PROGMEM APPSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

// LoRaWAN end-device address (DevAddr)
static const u4_t DEVADDR = 0x03FF0001 ; // <-- Change this address for every node!

```

and

```
 #ifdef PROGMEM
    // On AVR, these values are stored in flash and only copied to RAM
    // once. Copy them to a temporary buffer here, LMIC_setSession will
    // copy them into a buffer of its own again.
    uint8_t appskey[sizeof(APPSKEY)];
    uint8_t nwkskey[sizeof(NWKSKEY)];
    memcpy_P(appskey, APPSKEY, sizeof(APPSKEY));
    memcpy_P(nwkskey, NWKSKEY, sizeof(NWKSKEY));
    LMIC_setSession (0x1, DEVADDR, nwkskey, appskey);
    #else
    // If not running an AVR with PROGMEM, just use the arrays directly
    LMIC_setSession (0x1, DEVADDR, NWKSKEY, APPSKEY);
    #endif
```

[Next page](https://www.thethingsnetwork.org/forum/t/can-lmic-1-6-be-set-up-to-use-a-single-channel-and-sf/5207.md?page=2)
