2

For a Lora assay I am looking over the arduino lmic library furthermore I look over the pinout on RFM98 Lora Module:

enter image description here

But I cannot figure out how I will configure the library in order to use the MOSI and MISO pins (as far as I understand the recieved information will pass as serial in MOSI pin and I will send data in MISO pin) I mean the library provides this configuration:

lmic_pinmap lmic_pins = {
    .nss = 6,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 5,
    .dio = {2, 3, 4},
};

And I understand that .rxtx may be mapped on arduino's pins for data io into LOraWan network (using LoRa Modulation) but which goes first and which goes second?

I guess that the configuration code will be:

.rxtx={^somepin^,^anotherpin^}
3

This interface is perhaps not as well documented as it should be.

As it turns out, the actual SPI data and clock pins (SCK, MOSI, and MISO) are not specified in the struct; instead they are assumed to be wired consistent with the hardware SPI engine.

The arguments that are specified in the struct are limited to things which are configurable. That includes the slave select (NSS) and reset pins.

To clarify two points of apparent confusion:

  • rxtx: this is a transmit/receive mode control for the RF stage, not a data pin

  • dio: this vector of 3 pins represents the first three of the five sx127x DIO pins, which provide mode-dependent discrete functions. Typically for LoRa purposes DIO0 and DIO1 are used, while DIO2 is useful in some FSK modes. If a pin is not available, set it to LMIC_UNUSED_PIN.

For purposes of this library, packet buffer data is written and read over the SPI bus, rather than on discrete pins. It is possible to configure two of the DIO pins to be a data output and slicer clock, but that is not used here.

Some of this information can be gleaned from the README.md of the Arduino-LMIC library, but some of it is only clear in the code. Reading the Semtech data sheet is also useful.

| improve this answer | |
  • 1
    So in other words I can get the data transimted in LoRa via: arduino.cc/en/Reference/SPI – Dimitrios Desyllas Mar 27 '18 at 10:38
  • 1
    No, you get it from the LMIC library, which ultimately does SPI operations but does a lot of other necessary things as well. – Chris Stratton Mar 27 '18 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.