Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkrwan with single channel gw #32

Closed
conradholt opened this issue Sep 24, 2018 · 11 comments
Closed

mkrwan with single channel gw #32

conradholt opened this issue Sep 24, 2018 · 11 comments

Comments

@conradholt
Copy link

So, after trying to set up (without success) the mkrwan with a single channel gateway I am asking if someone has been able to do that?
Currently the mkr fw doesn't have the option (like the uno's) to disable channels, I would like the mkr to send data just on the 902.3 Mhz channel not the rest.

@facchinm
Copy link
Contributor

Hi @conradholt ,
what do you mean with "like the UNO"? The Semtech chip inside the Murata module can be controlled independently (using this library https://github.com/sandeepmistry/arduino-LoRa ) if you want to implement a point-to-point communication (which I believe is what a 1channel "gateway" does.

@conradholt
Copy link
Author

Sorry for the misunderstanding @facchinm , I hope this makes things a bit more clear,

One of the nodes is an arduino uno + dragino v1.4 shield using the lmic library (https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-abp/) with a small modification in the set-up:

LMIC_setDrTxpow(DR_SF7,14);
for (int i=1;i<64;i++)
{
LMIC_disableChannel(i); // only the first channel 902.3Mhz works now.
}

The gateway is the dragino LG01 using the sx1276 semtech transceiver running the single_channel_pkt_fwd (https://github.com/tftelkamp/single_chan_pkt_fwd).
This set-up is able to send data to ttn, which i'm also trying to accomplish using the arduino mkr1300 as another end-node. I am positive that because I can't set the mkr to only send data on the 902.3Mhz my gateway is not receiving any packet from the mkr (maybe if i leave it overnight the gw will detect some packets but with a lot of them being missed). I am not trying to set a point-to-point communication, I am trying to set a LoRaWAN network using a single_channel gateway and multiple nodes.

@facchinm
Copy link
Contributor

@conradholt you can still use lmic with the MKRWAN in this way:
before calling os_init you need to instantiate a LoRaModem and call dumb() on it.
From then on, you can use SPI1 and LORA_IRQ_DUMB pins and run all the stack in the D21 itself https://github.com/arduino-libraries/MKRWAN/blob/master/src/MKRWAN.h#L541
The pinmapping should become

const lmic_pinmap lmic_pins = {
    .nss = LORA_IRQ_DUMB,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = LORA_RESET,
    .dio = {LMIC_UNUSED_PIN, LMIC_UNUSED_PIN, LMIC_UNUSED_PIN},
};

and you should change SPI into SPI1 here

Let me know if it works for you!

@conradholt
Copy link
Author

@facchinm I haven't been able to make it work, let me walk through the steps to see if I've missed something.
using the example from the abp library https://github.com/matthijskooijman/arduino-lmic/blob/ba1265d5d2f775177cdc7c82186724e4f0bdc3a8/examples/ttn-abp/ttn-abp.ino I have included the mkrwan library, then I've instantiated (as global) a LoRaModem modem, and I've called modem.dumb() in the setup before os_init. Then I've created the pin mapping as you mentioned. Next I've changed SPI to SPI1 (but not SPI_MODE0 this still the same right?) in the hal.cpp file and uploaded this new lmic.h library.
At first I'm getting errors from the ASSERT functions in hal.cpp (FAILURE /tmp/505991622/custom/arduino-lmic/src/hal/hal.cpp:23) if I comment this ASSERT then line :24 complains, if I comment this line then radio.cpp:689 complains, if I comment then radio.cpp:545, finally if I comment this then there's no error on the serial monitor but the code is "frozen" somewhere because I'm not able to see the prints from my main code...

There might be some problem with the pin mapping? because the ASSERTS basically check:
ASSERT(lmic_pins.dio[0] != LMIC_UNUSED_PIN);
ASSERT(lmic_pins.dio[1] != LMIC_UNUSED_PIN || lmic_pins.dio[2] != LMIC_UNUSED_PIN);

Any thoughts on what to do next?

@facchinm
Copy link
Contributor

Ah, my fault, lmic requires DIOs to serve interrupts (https://github.com/matthijskooijman/arduino-lmic/blob/ba1265d5d2f775177cdc7c82186724e4f0bdc3a8/src/hal/hal.cpp#L69) 🙁 We don't have enough exposed pins to handle this; there could be other libraries that do not need the IRQ pins but I'm not aware of them

@ivanpiffer
Copy link

so @conradholt tell me ... did you resolve it? I'm in the same situation ... the dragino LG01_P and I don't know how to set up my mkr wan 1300 with only 1 channel :(

@conradholt
Copy link
Author

unfortunately @ivanpiffer the sam21d or the mkr series won't support the single channel configuration because it's doing frequency hops on more than one frequency. If you get an arduino uno or any arduino working on AVR then the LMIC example code works just fine.

Finally I purchased a multichannel gateway (LAIRD sentrius) and the mkr was plug and play for both OTAA/ABP.

@conradholt
Copy link
Author

@facchinm you can close this issue since the mkr won't support single channel

@facchinm
Copy link
Contributor

facchinm commented Feb 1, 2019

Ok, I'm sorry it didn't end well. Closing as wontfix

@facchinm facchinm closed this as completed Feb 1, 2019
@deanpretorius
Copy link

I am stuck in the same situation with a bunch of these boards and a single channel gateway. Is there a way to fix this?

Ah, my fault, lmic requires DIOs to serve interrupts (https://github.com/matthijskooijman/arduino-lmic/blob/ba1265d5d2f775177cdc7c82186724e4f0bdc3a8/src/hal/hal.cpp#L69) 🙁 We don't have enough exposed pins to handle this; there could be other libraries that do not need the IRQ pins but I'm not aware of them

Are there any other, more recent, libraries that do not need IRQ pins, or is there a way of making pins available to handle these interrupts by disabling unneeded services on the MKR WAN?

@facchinm
Copy link
Contributor

Hi @deanpretorius ,
single channels gateways are not compatible with LoRaWAN at all since they don't implement channel hopping. The cheapest multichannel gw (https://www.thethingsnetwork.org/docs/gateways/thethingsindoor/) works just fine. GrumpyOldPizza/ArduinoCore-stm32l0#57 allows you to program the LoRa module directly, so with a bit of effort the same result can be achieved but there's nothing ready to use yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants