Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LR11X0] pay more attention to selection of FSK preamble detector length #1286

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

lyusupov
Copy link
Contributor

@lyusupov lyusupov commented Oct 23, 2024

Brief description

Most of FSK radio protocols supported by SoftRF project are using 8-bit FSK preamble:

  1. https://github.com/lyusupov/SoftRF/blob/master/software/firmware/source/SoftRF/src/protocol/radio/OGNTP.h#L24-L25
  2. https://github.com/lyusupov/SoftRF/blob/master/software/firmware/source/SoftRF/src/protocol/radio/ADSL.h#L24-L25
  3. https://github.com/lyusupov/SoftRF/blob/master/software/firmware/source/SoftRF/src/protocol/radio/Legacy.h#L25-L26

Current RadioLib code uses explicit 16 bit FSK preamble detector length


image

This causes almost 95% loss of packets while trying to receive radio packets sent by other (SX1262 and SX1276) devices ( these packets use 8-bit FSK preamble ).

This PR is filed to fix the issue of not receiving 8-bit FSK preamble packets.
The fix has been validated on Seeed SenseCAP T1000-E device - it uses Semtech LR1110 radio IC.

@jgromes
Copy link
Owner

jgromes commented Oct 23, 2024

Thank you for the contribution! Everything seems OK so this can be merged.

I think it would also make sense to add a similar configuration to SX126x, which also uses 16 bits as the default, so I would expect it to behave the same as LR11x0 in terms of the packet loss. SX127x does not change the default setting which should be 8 bits, but the configuration could also be added. Would you be willing to add those changes in another PR? If not I will add it myself.

Thanks again!

@jgromes jgromes merged commit 434afa5 into jgromes:master Oct 23, 2024
30 checks passed
@lyusupov
Copy link
Contributor Author

lyusupov commented Oct 23, 2024

I think it would also make sense to add a similar configuration to SX126x, which also uses 16 bits as the default, so I would expect it to behave the same as LR11x0 in terms of the packet loss.

I am not sure that it is necessary....

The SoftRF uses other libraries to drive SX1276 and SX1262.radios on a regular basis

However, before I got access to the actual LR1110 device - I've emulated the logic of the LR11XX SoftRF driver by building and running on SX1262: https://github.com/lyusupov/SoftRF/blob/master/software/firmware/source/SoftRF/src/driver/radio/radiolib.cpp#L60-L61

I can say that I have not noticed any issues while running FSK modulated radio protocols with 8-bit preamble together with SX126X RadioLib driver.

It looks like the LR11X0 uses different values:

  1. preamble length for Transmitter
  2. preamble Detect length for Receiver

@jgromes
Copy link
Owner

jgromes commented Oct 26, 2024

It looks like the LR11X0 uses different values:

  1. preamble length for Transmitter
  2. preamble Detect length for Receiver

That is also the case for SX126x, the last argument sets detector length to RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16:

int16_t setPacketParamsFSK(uint16_t preambleLen, uint8_t crcType, uint8_t syncWordLen, uint8_t addrCmp, uint8_t whiten, uint8_t packType = RADIOLIB_SX126X_GFSK_PACKET_VARIABLE, uint8_t payloadLen = 0xFF, uint8_t preambleDetectorLen = RADIOLIB_SX126X_GFSK_PREAMBLE_DETECT_16);

So I would expect it to behave in a simlar to way tthe LR11x0 did. I will go ahead and add this, even if it seems like this is not causing a problem, there might be some other reason for that.

@lyusupov
Copy link
Contributor Author

Yes, I agree that SX126x needs a proper setting of preambleDetectorLen as well:

image

Hmm, I am curious, why I have not noticed high Rx packets loss ratio with 8-bit preamble detector on SX1262 and RadioLib...
I should probably test it again, when able.

SoftRF project uses a customized BASICMAC library to drive SX1262 on a regular basis.
We select the preamble detector length as follows:

https://github.com/lyusupov/SoftRF/blob/master/software/firmware/source/libraries/arduino-basicmac/src/lmic/radio-sx126x.c#L503-L529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants