FSK Packet RSSI #1754
Replies: 3 comments 1 reply
|
Sorry, the "does not change for the duration of the session" part was due to an error in my test code. But the bigger problem remains, that getRSSI() in FSK mode does not give a useful measurement unless it is done during the reception of a packet. Which probably should be done via an interrupt. I've found an interim kludgy solution, implemented in my code external to RadioLib, and tested working on the sx1276 so far: My program has the packet-receive-complete interrupt set a flag, and the main loop of the program polls that flag, about every 2 ms (usually). (Because it is a simple Arduino-type program with one main loop().) So added this code to that polling: if listening is active, and if packet reception has not been completed, and if the time since the last measurement is about a half of the expected packet's air time, then take an RSSI sample and stash it. Once reception is complete, report that stashed value. Since the measurements happen often enough, there is normally a measurement from during the packet reception. (If the stashed value is too old, ignore it.) |
|
OK. For some reason I don't see (on an sx1262) RSSIs like you mentioned, e.g., -40. Even at close range I get about -70, and -100 from across the room. On the same device, with older firmware that did not use RadioLib, I got more reasonable numbers. I can't figure out why. |
|
It is better on the sx1262, not sure why I had trouble with it at first. The datasheet says that for FSK: "RSSI average value over the payload of the received packet. Latched upon the pkt_done IRQ." Thus don't need a separate interrupt. |
Uh oh!
There was an error while loading. Please reload this page.
For my application, getting the (packet) RSSI is useful. The RadioLib getRSSI() function for FSK seems to not work, at least on the sx1276 and sx1262. I get a seemingly random number, that does not change for the duration of the session (even as I move the transmitter around). I know it is possible to do this right, since the previous library that I am transitioning away from ("BASICMAC") does the RSSI well. Looking at the sx1276 code there, it seems to do it in response to an interrupt:
if (irqflags2 & IRQ_FSK2_PAYLOADREADY_MASK) { // 0x04
...
} else if (irqflags1 & IRQ_FSK1_SYNCADDRESSMATCH_MASK ) // 0x01
LMIC.rssi = - readReg(FSKRegRssiValue) / 2; // 0x1A
Also it seems the sx1276 has options in how the RSSI sampling is set up, but I am not sure what the best choices are. RadioLib does: setRSSIConfig(2); (8 samples) but a larger sample gives better precision. Then again, how are the samples collected - within the same packet? Other packets may be from other transmitters thus irrelevant.
How to get this working in RadioLib? I can work on this, but need guidance. Thanks.
All reactions