Connection p2p with two RN2483 and LoRaWan gateway

hi scl, yes I do, this one is the one from the receiver

Configuring LoRa module...
Setting device in lora modulation: ok
Setting frequency: ok
Setting power: ok
Setting sf: ok
Setting afcbw: ok
Setting rxbw: ok
Setting fdev: ok
Setting prlen: ok
Setting crc: ok
Setting cr: ok
Setting sync: ok
Setting bw: ok
Setting wdt: ok
Setting IQ inversion: ok
LoRa module ready.
Node 02010103: Receiving...
-1
4294967245
LoRa status:
Node 02010103: Receiving...
-1
4294967245
LoRa status:
Node 02010103: Receiving...
-1
4294967245
LoRa status:
Node 02010103: Receiving...
-1
4294967245
LoRa status:
Node 02010103: Receiving...

The 4294967245 is the answer to mac pause command

on the TX It looks like

Configuring LoRa module...
Setting device in lora modulation: ok
Stting frequency: ok
Setting power: ok
Setting sf: ok
Setting afcbw: ok
Setting rxbw: ok
Setting fdev: ok
Setting prlen: ok
Setting crc: ok
Setting cr: ok
Setting sync: ok
Setting bw: ok
Setting IQ inversion: ok
Setting wdt: ok
LoRa module ready.
Node 02010103:Sending...
Node 02010103 sending: HI
Pausing mac: 4294967245
sending to radio: HI
LoRa status:
Node 02010103:Sending...
Node 02010103 sending: HI
Pausing mac: ok
radio_tx_ok
4294967245
sending to radio: HI
LoRa status:

try to set the timeout to 0, after setting watchdog to 0

radio set wdt 0 radio rx 0

This will let the node listen for ever for incoming messages. Hope it does something.

HI scl,thanks again,

I have set it in both, on the receiver I do get now this

Setting prlen: ok
Setting crc: ok
Setting cr: ok
Setting sync: ok
Setting bw: ok
Setting wdt: ok
Setting IQ inversion: ok
LoRa module ready.
Node 02010103: Receiving...
-1
LoRa status:
Node 02010103: Receiving...
52
LoRa status:
Node 02010103: Receiving...
50
LoRa status:
Node 02010103: Receiving...
57
LoRa status:
Node 02010103: Receiving...
52
LoRa status:
Node 02010103: Receiving...
57
LoRa status:
Node 02010103: Receiving...
54
LoRa status:
Node 02010103: Receiving...
55
LoRa status:
Node 02010103: Receiving...
50
LoRa status:
Node 02010103: Receiving...
52
LoRa status:
Node 02010103: Receiving...
53
LoRa status:
Node 02010103: Receiving...
13
LoRa status

I use something like this

Serial1.write(ā€œmac pause\r\nā€);
//setting window to zero
Serial1.write(ā€œradio set wdt 0\r\nā€);
//setting the rx to continous mode of reception
Serial1.write(ā€œradio rx 0\r\nā€);

Serial.println(Serial1.read());

the sender looks like

Serial.print("Pausing mac: ");
Serial1.write(ā€œmac pause\r\nā€);
delay(50);
while (Serial1.available()) Serial.write(Serial1.read());

Serial.print("sending to radio: ");
Serial1.write(ā€œradio tx 1\r\nā€);
while (Serial1.available()) Serial.write(Serial1.read());

Serial1.println(message);
Serial.println(message);
LoRaBlink();
LoRaBlink();
LoRaBlink();

Try setting the radio parameters just after mac pause, the LoRaWAN protocol might be adjusting the parameters. So in between of mac pause and radio rx 0.

After sending the rx command RN2483 will first transmit ok and then when it receives something radio_rx <data>. So you just have to wait then with serial.available().

What is this 52 number? Is this the length of the received packet? Try printing the received message.

I have set up the mac pause at the begining, and then the configuration parameters. In the same way now the RX code is just these lines

Serial1.begin(57600);
while (!Serial1);

Serial1.write(ā€œradio rx 0\r\nā€);
while (Serial1.available()) Serial.write(Serial1.read());

The output is then

Configuring LoRa moduleā€¦
Pausing mac: 4294967245
Setting device in lora modulation: ok
Setting frequency: ok
Setting power: ok
Setting sf: ok
Setting afcbw: ok
Setting rxbw: ok
Setting fdev: ok
Setting prlen: ok
Setting crc: ok
Setting cr: ok
Setting sync: ok
Setting bw: ok
Setting wdt: ok
Setting IQ inversion: ok
LoRa module ready.
Node 02010103: Receivingā€¦
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy
Node 02010103: Receivingā€¦
busy

I didnā€™t know where was coming that 52

Do you use the readWaitLn function, this doesnā€™t work without timeout very wellā€¦

The busy keyword means the module is actually listening. So when it has received something this should disappear. Busy is correct is what I mean to say.
Now try to send some message. First with radio set iqi on and the radio set iqi off. And make sure the parameters are the same, also in the transmitter. In one of your previous messages I saw you are pausing mac just before sending, try setting radio parameters after pausing in the transmitter as well. Otherwise I will quicly run out of ideas as well.

Do you have a picture of your setup?

OK then it is waiting to get something, however I am sending and it does not receive anything yet. Now I have both devices with radio set iqi on and it seems not working, the say way i had them before with offā€¦

A picture in which sense? I donā€™t have anything connected to thet board.

thanks

Just a photograph of the two RN2483 modules and how they are connected.
From the code I cannot make up why it doesnā€™t work, perhaps the phyical setup is wrong.
Otherwise I donā€™t know it. I was able to communicate between my RN2483 module and a SX1276 module, so it should be possible to send and receive p2p.

Are you able to communicate with a gateway? Perhaps you can use the other module to eavesdrop on this connection.

I donā€™t have anything connected to it, they were able to connect to the gateway indeed, but I only have two modules, so it would not be enough, further, if I disable the LoRaWan stack, the gateway wonā€™t see much right?

@scl how does your code look like? I mean the sending and receiving part

My set up in both nodes is this

 Serial.print("Pausing mac: ");
  Serial1.write("mac pause\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  
  Serial.print("Setting device in lora modulation: ");
  Serial1.write("radio set mod lora\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting frequency: ");
  Serial1.write("radio set freq 868000000\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting power: ");
  Serial1.write("radio set pwr 14\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting sf: ");
  Serial1.write("radio set sf sf12\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting afcbw: ");
  Serial1.write("radio set afcbw 125\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting rxbw: ");
  Serial1.write("radio set rxbw 250\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting fdev: ");
  Serial1.write("radio set fdev 5000\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting prlen: ");
  Serial1.write("radio set prlen 8\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
//  Serial.print("Setting crc: ");
//  Serial1.write("radio set crc on\r\n");
//  delay(50);
//  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting cr: ");
  Serial1.write("radio set cr 4/8\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting sync: ");
  Serial1.write("radio set sync 12\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting bw: ");
  Serial1.write("radio set bw 250\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting wdt: ");
  Serial1.write("radio set wdt 0\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
  Serial.print("Setting IQ inversion: ");
  Serial1.write("radio set iqi on\r\n");
  //Serial1.write("radio get iqi\r\n");
  delay(50);
  while (Serial1.available()) Serial.write(Serial1.read());
  LoRaBlink();
osjob_t initjob;
led_init();
uart_init();

debug_str("hallo\r\n");

// LoRa Standby MODE
writeReg(0x01, 0x81);
// Set frequency 869525000 -> 868300000
writeReg(0x06, 0xD9);
writeReg(0x07, 0x61); //13
writeReg(0x08, 0x99); //33
// Set RF Amplifier
writeReg(0x09, (0<<7)|(7<<4)|(14<<0)); //7f
// Set Amplifier Ramp-up
writeReg(0x0A, 0x08);
// Set LNA
writeReg(0x0C, 0x23); // Max gain, LNA-boost on
// Set LoRa page registers
writeReg(0x0E, 0x00);
writeReg(0x0F, 0x00);
// Setup interrupts
writeReg(0x40, 0b00111111); // set irq type, receive DIO0
writeReg(0x12, 0xFF); // reset flags
writeReg(0x11, 0x00); // mask
// Modem configure
writeReg(0x1D, 0x72); // 125 kHz, cr 4/5, explicit header
writeReg(0x1E, 0xC0); // SF12, CRC disable
writeReg(0x26, 0x04 | 0x08); // LNA gain internal AGC loop, low data rate optimize
// IQI configure
writeReg(0x33, 0x67); // IQI mode (27 = enabled or 67 = disabled)
writeReg(0x3B, 0x19); // 1D or 19
// send
hal_pin_rxtx(1);
// Setup payload - length 5
writeReg(0x0D, 0x00);

writeReg(0x22, 0x20);
writeBuf(0x00, buf, 32);
// Set to LoRa receive MODE
writeReg(0x01, 0x83);
//writeReg(0x01, 0x85);

u1_t mode = 0;

while(1) {
	delay_ms(2000);
	u1_t val = readReg(0x01);
	mode = val;
//		writeReg(0x0D, 0x00);
	// Setup payload - length 5
//		writeBuf(0x00, buf, 32);
	// Set to LoRa receive MODE
//		writeReg(0x01, 0x83);
}

This was my code to control SX1276, in combination with the LMiC library and an XMC1100 starter kit. But the RN2483 should be able to do the same with some commands (because under the hood it is the same).

I was using RN2483 with a USB-UART (3.3Volt) converter and a serial console. And entering commands manually. Shouldnā€™t you use an antenna btw, i see none in your picture?

According to the doc of TTU it does not need an extra antenna, thereā€™s one antenna the one labeled in the picture as AF.

Looking your code, I see two things different from mine, first you disable the CRC when transmitting is that a reason for? I have done it as well, no luck thouh. The second one is that you specify a payload of , where can I do that in the RN2483 ? with the command radio tx 5 and radio rx 5?

Shouldnā€™t make a difference, disabling CRC only you would get an error in receive if the CRC is incorrect but it would give a signal.

Payload length is only needed when using implicit headerā€¦ So that one is not used. I did both receiving and transmitting with this code, but it seems I have mixed it up a bit.
I used this code below in the receive interrupt btw:

u1_t len = readReg(0x13);
u1_t snr = readReg(0x19);
u1_t rssi = readReg(0x1A);
u1_t buffe[512] = {0};

// set pointer to 0
writeReg(0x0D, 0x00);
readBuf(0x00, buffe, len);

writeReg(0x12, 0xFF);

But this has nothing to do with your problem. I think I donā€™t know how to solve your problem unfortunately, I ran out of ideas. The antenna seems te be fine.

Thank you very much for your help scle, I really appreciate it. I donā€™t know neither where is the issue, maybe I should throw away this platform and go for a different one. I am run out of ideas as well.

Hi @ndarkness, do not give up :wink:

I have two nodes like this: 868MHz RN2483 LoRaā„¢ Technology Mote and managed to get them to talk to each other as described in the link @sergiosena provided earlier (setting all parameters etc.).

I decided to take small steps and started with a simple setup connecting both nodes to my Windows PC. Both were recognised as serial ports (in my case COM6 & COM7). I then used a serial monitor/terminal application (like Tera Term) and initially entered all commands per hand. I know, not optimal but served the purpose and I know that the nodes can talk to each other. :smile:

Now my plan is to write scripts/programs to automate the stuff so thanks to all for some ideas in this thread.

I cross my fingers for your tests to success.

Hi @ksl2europe thank you,

Well my nodes are already mounted in the TTU, so as starting I am using arduino workbench to develop, the code, I had just to simple functions on configuing the other sending or receiving. Thus not big deal, I increased arduino void function timeout to have enough transmission time, but as you see in the post not luckā€¦

Hi @ndarkness,

how about running a simple ā€œserial in, serial out sketchā€ on Arduino as described here for the WiFi chip: Arduino to ESP8266 By Serial Communication? I guess this way the RN2483 shall be easier to control during your tests.

Cheers,
K.

Thanks @ksl2europe, but my chip is embbeded on the aurdion board, since is the The Things Uno, so you mean that I read from the serial pins of the TTU the serial port?

Interestingly, I also played with the P2P connection between two RN2483 . Indeed, it succeeds in transmitting data in both directions. Just fun to test, :wink:

2x RN2483 connected via ftdi to usb

Output on serial monitor

Good luck to those who continue to develop :wink:

2 Likes

I also played with p2p RN2483 walking around with a laptop.

My code is available here : https://bitbucket.org/oetelaar/lora_rn2483/src