Skip to content

Commit db786f3

Browse files
Allow disabling I/Q inversion on RX
By uncommenting a maco in config.h, this inversion is enabled, and communication between nodes can be enabled. This should be used just for debugging, though.
1 parent d0b1985 commit db786f3

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

examples/raw/raw.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include <hal/hal.h>
2121
#include <SPI.h>
2222

23+
#if !defined(DISABLE_INVERT_IQ_ON_RX)
24+
#error This example requires DISABLE_INVERT_IQ_ON_RX to be set. Update \
25+
config.h in the lmic library to set it.
26+
#endif
27+
2328
lmic_pinmap pins = {
2429
.nss = SS,
2530
.rxtx = 8, // Not connected

src/lmic/config.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,14 @@
3939
//#define DISABLE_MCMD_PING_SET // set ping freq, automatically disabled by DISABLE_PING
4040
//#define DISABLE_MCMD_BCNI_ANS // next beacon start, automatical disabled by DISABLE_BEACON
4141

42+
// In LoRaWAN, a gateway applies I/Q inversion on TX, and nodes do the
43+
// same on RX. This ensures that gateways can talk to nodes and vice
44+
// versa, but gateways will not hear other gateways and nodes will not
45+
// hear other nodes. By uncommenting this macro, this inversion is
46+
// disabled and this node can hear other nodes. If two nodes both have
47+
// this macro set, they can talk to each other (but they can no longer
48+
// hear gateways). This should probably only be used when debugging
49+
// and/or when talking to the radio directly (e.g. like in the "raw"
50+
// example).
51+
#define DISABLE_INVERT_IQ_ON_RX
4252
#endif // _lmic_config_h_

src/lmic/radio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,10 @@ static void rxlora (u1_t rxmode) {
547547
writeReg(RegLna, LNA_RX_GAIN);
548548
// set max payload size
549549
writeReg(LORARegPayloadMaxLength, 64);
550+
#if !defined(DISABLE_INVERT_IQ_ON_RX)
550551
// use inverted I/Q signal (prevent mote-to-mote communication)
551552
writeReg(LORARegInvertIQ, readReg(LORARegInvertIQ)|(1<<6));
553+
#endif
552554
// set symbol timeout (for single rx)
553555
writeReg(LORARegSymbTimeoutLsb, LMIC.rxsyms);
554556
// set sync word

0 commit comments

Comments
 (0)