I'm using RFM95 on LoRa mode with STM32F103. My code is very simple, I'm just using the controller as a "bridge" between serial and SPI.
if (Serial.available()>0) {
inByte = Serial.read();
if(fifao==0) {
if (inByte=='R') {
//if we send R to the serial port it will print all registers values --- it is all working here
imprimeregist();
} else if (inByte=='r') {
//if we send r to the serial port it will read all fifo addres from 0 to 0x80 and print it in the screen --- it is all working here
lefifo();
} else if(inByte=='F') {
//if we send F to the serial port it will read the fifo address and return the value--- it is all working here
Serial.println(F("type fifo address please: "));
fifao=1;
} else {
//if we type any other thing it will write the next typed value to the address specified
entrada[contser]=inByte;
contser++;
}
} else {
fifu=inByte;
Serial.println(spiRcv(fifu),HEX);
fifao=0;
}
if(contser==2) {
//writing the value ---------------- it is working here too
writeSPI(entrada[0],entrada[1]);
Serial.println( spiRead(entrada[0]),HEX);
contser=0;
}
I'm using the Arduino IDE (I used a lot of software and got to the same place). I just can't transmit.
I wrote the registers in one of them to RX LoRa mode and in the other one to TX LoRa mode.
Can anybody help me? Maybe with the values of the registers I have to use or the way I have to do for transmitting and receiving data.
In order to reduce interference, Lora node radios use I/Q inversion on receive in order to hear only the Gateway and not each other.
In order for two Lora nodes to talk to each other directly, their invert IQ flags need to be cleared (as seen here https://github.com/things-nyc/arduino-lmic/blob/master/src/lmic/radio.c#L590)
Once you do that they should be able to hear each other. Here's sample Arduino sketch that does it: https://github.com/things-nyc/arduino-lmic/blob/master/examples/raw/raw.ino