Quantcast
Channel: The Things Network - Latest posts
Viewing all articles
Browse latest Browse all 116641

Connection p2p with two RN2483 and LoRaWan gateway

$
0
0
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?


Viewing all articles
Browse latest Browse all 116641

Trending Articles