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

[SX126x] LR-FHSS support #1228

Merged
merged 13 commits into from
Oct 7, 2024
Merged

[SX126x] LR-FHSS support #1228

merged 13 commits into from
Oct 7, 2024

Conversation

jgromes
Copy link
Owner

@jgromes jgromes commented Sep 22, 2024

This pull request adds support for LR-FHSS transmission from the SX126x module.

It is currently only verified by comparison of the transmitted signal to one sent from LR1110. The frequency hopping and packet length seems to match, however, it is not possible to test the encoding this way. A proper test would involve a LR-FHSS-capable LoRaWAN gateway.

@jgromes jgromes marked this pull request as draft September 22, 2024 18:50
src/utils/FEC.cpp Fixed Show fixed Hide fixed
@c3podaniel
Copy link

https://github.com/jumanamirza/LR-FHSS-receiver

Have you already seen this?

@jgromes
Copy link
Owner Author

jgromes commented Oct 2, 2024

@c3podaniel no, I haven't seen that project (thanks for pointing me to it!), however, I'm not sure how I would use it. From what I can tell it works with recorded data, but it does not specify how they are recorded.

@c3podaniel
Copy link

@c3podaniel no, I haven't seen that project (thanks for pointing me to it!), however, I'm not sure how I would use it. From what I can tell it works with recorded data, but it does not specify how they are recorded.

This is the paper behind the project. https://dl.acm.org/doi/10.1145/3694971
They used a SDR to record the data.

@jgromes
Copy link
Owner Author

jgromes commented Oct 2, 2024

@c3podaniel that is actually a pretty good paper, thanks - shame the repository itself doesn't link to it. I'll take a look, maybe this could be a way to validate this PR.

@StevenCellist
Copy link
Collaborator

The used SDR is a casual €2200, wow. Thought I'd maybe get an SDR after all, but definitely not that one! 😆

@jgromes
Copy link
Owner Author

jgromes commented Oct 6, 2024

After some modifications, I was able to run the LR-FHSS-Receiver project in Octave. I also figured out how to record the data in a format the project expects, with the following simple GNUradio flowgraph:

Screenshot_109

With that, I was able to decode the headers, so at least those are being constructed, encoded and sent correctly:

lrfh sim detecting header ... done
Elapsed time is 3.61704 seconds.
decoding candi header 1, found header 1: idx 2, CR 3, start 54421, freq 16260.98, power 4.16, cost 27.91
decoding candi header 2, FAIL, coarse time 166003, coarse freq -57540.00
decoding candi header 3, found header 2: idx 1, CR 3, start 171211, freq -57725.85, power 5.57, cost 25.56
decoding candi header 4, found header 3: idx 0, CR 3, start 287723, freq -26739.02, power 4.67, cost 33.75

However, when decoding the payload, the receiver unfortuantely uses vitdec function from Matlab's communication toolbox, which is not available in Octave, so I will have to figure out a way around that. But since the header is already encoded with 1/2 convolutional code and obviously decodes correctly, I'm about 90% sure the payload is encoded correctly as well.

@StevenCellist

The used SDR is a casual €2200

The B210 is a total overkill for this, you should be able to do this with a cheap RTL-SDR dongle ;) They used just 500 kSps sampling rate for the EU868 data rates - B210 can go up to 56 MSps. My HackRF One actually can't even go down to 500 kSps, hence the resampler in my flowgraph above.

@jgromes jgromes marked this pull request as ready for review October 7, 2024 17:51
@jgromes
Copy link
Owner Author

jgromes commented Oct 7, 2024

With help from @StevenCellist, we were able to validate decoding of the recorded data in Matlab (after fixing a bug in the payload CRC calculation) - the string Hello World! #17 was transmited from SX1262 and decodes correctly:

>> lrfh_sim
File: 3002, DR8
lrfh sim genterating signal ... done
lrfh sim detecting header ... done
Elapsed time is 0.244282 seconds.
decoding candi header 1, found header 1: idx 2, CR 3, start 54421, freq 17141.46, power 11.51, cost 6.65
decoding candi header 2, found header 2: idx 1, CR 3, start 171128, freq -56849.76, power 9.57, cost 6.76
decoding candi header 3, found header 3: idx 1, CR 3, start 171108, freq -56845.85, power 9.55, cost 6.02
decoding candi header 4, found header 4: idx 0, CR 3, start 288031, freq -25853.66, power 10.34, cost 7.76
decoding candi header 5, FAIL, coarse time 301028, coarse freq -25860.00
CRC: 1100100011001000
pkt 1: CRC PASS
pkt 1: CR 3, cost 0.00, data [48, 65, 6c, 6c, 6f, 20, 57, 6f, 72, 6c, 64, 21, 20, 23, 31, 37]

There are still likely some corner cases in other configurations (e.g. hop sequence seed for US hopping grid), but I'm confident enough in this feature to merge this now.

@c3podaniel Thanks again for pointing me to that project and paper!

@jgromes jgromes merged commit dc77e6e into master Oct 7, 2024
30 checks passed
@jgromes jgromes deleted the sx126x-lr-fhss branch October 7, 2024 18:00
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.

3 participants