jamct / radio-mailbox

ESP32 with LoRa and a proximity sensor
GNU General Public License v3.0
33 stars 11 forks source link

Use a different SF? #3

Closed gaijinsr closed 5 years ago

gaijinsr commented 5 years ago

Hi, in line 67 of radio-mailbox/03_lora_test/lib/RFM95/RFM95.cpp there is

//Spreading factor 7, PayloadCRC On RFM_Write(0x1E,0xB4);

My gateway receives the packages with SF7 as expected - or rather not: From the documentation of the chip I understand that bits 4-7 of the 1E register (i.e. the higher hex digit) give the SF, so I would expect the SF to be B=11 and not 7... How can I use a larger SF (for longer range)?

Best, Stefan

gaijinsr commented 5 years ago

Hi, to answer my own question: I was mislead: Register 1E is set to this strange value only during initialization, when the packet is actually sent (line 243), it does RFM_Write(0x1E,0x74); //SF7 CRC On and there is the 7 that I expected. Changing this to 9 really makes the module use SF9.

What also took me quite some time to find out: LoRaWan jumps between channels (see lines 193ff), so if you use a cheap 1-channel gateway with an ESP and a single RFM95, you will only receive a fraction of the packets. By commenting out the channel hopping I was able to receive all my packets.