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

problems with non-default spreading factor for rfm9x. #8

Closed
jerryneedell opened this issue Jan 19, 2025 · 6 comments · Fixed by #10
Closed

problems with non-default spreading factor for rfm9x. #8

jerryneedell opened this issue Jan 19, 2025 · 6 comments · Fixed by #10
Assignees

Comments

@jerryneedell
Copy link
Collaborator

I am once gain going to see if I can make any progress on the non default settings for the spreading factor, initially reported in:

adafruit/Adafruit_CircuitPython_RFM9x#94
adafruit/Adafruit_CircuitPython_RFM9x#70

I'll post updates here.

Anyone else is welcome to join in with comments/suggestions.

@jerryneedell jerryneedell self-assigned this Jan 19, 2025
@jerryneedell
Copy link
Collaborator Author

jerryneedell commented Jan 19, 2025

Just some initial findings:
Using the RadioHead configuration with Ack enabled (reliable datagram). I am able to send/receive packets for spreading factors 7,8,9,10 and 11 but not for 6 or 12.

Also for spreading factors > 8, I had to increase the "ack_wait" timeout -- I tried increasing it from .1 to .5 and it seems to be working.

This is consistent with previous findings, If I recall correctly, it was only SF 6 and 12 that are not working.

edited to add: SF 12 sort of works, but the timing of the ACK and transmit_timeout may need some adjusting.
Packets do get sent but ACKs are lost

@jerryneedell
Copy link
Collaborator Author

I think SF =6 is needs to be set aside for now...
According to the SX126 data sheet "Note With SF = 6 selected, implicit header mode is the only mode of operation possible."

This library assumes the header is in "explicit" mode. Several changes would be needed to implement "implicit" mode.

So I think that SF 7-12 are actually working OK, but fir the higher SF especially 12, more experimentation on the timing parameters is needed due to the increase in the packet transmission and receive times. I'll be looking into that more.

Once SF 7-12 are confirmed to be working, I'll look at SF= 6

@jerryneedell
Copy link
Collaborator Author

some progress, I am able to send and received with SF 7-12 but some "tweaks" of the timing parameters are needed.
The parameters I have been adjusting are:
rfm.ack_wait (default =.1)
rfm.xmit_timeout (default = 2)
rfm.low_datarate_optimize (default =0)
ram.receive_timeout (default = .5)

SF    ack_wait    receive_timeout    xmit_timeout     low_datarate_optimixe
7       .1              .5               2                     0 
8       .1              2                2                     0
9       1               2                2                     0
10      1               2                2                     0
11      1               2                2                     0
12      1               5                5                     1

Note - the SF and low_datarate_optimize setting must match on the transmitter/receiver. The timing parameters may be somewhat different.... your mileage may vary .....

There was a lot of trial/error involved and the setting may have to be adjusted for packet length -- my packets are about 30 bytes (payload).

This is progress... it is nice to see the packet flowing.

@jerryneedell
Copy link
Collaborator Author

I am making some progress with SF=6
I can send and receive SF=6 packets after enabling "Implicit header" mode on both the sender and receiver.
This required some changes in the library to set the header mode automatically.
In addition, the packet length must be set manually and it must be known to both the sender and receiver.
Essentially, a "fixed length" packet is required or both sides have to know when it changes.

This is currently not compatible with the "reliable datagram" mode since the ACK is not properly generated. More work will be needed for that.

with this, all SF modes are working ... it may not be easy to invoke them, but they are all functional.

@codebreaker133
Copy link

Now that we have full use of spreading factor (with tweaks to timings) someone may want to go update the docs on circutpython's website, been troubleshooting sf until I found this thread, would definitely have made it easier to be listed on the docs. some of those timing variables aren't even listed if i remember correctly

@jerryneedell
Copy link
Collaborator Author

Yes, good suggestion. I am working on a new guide. Please report any problems you run into.

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 a pull request may close this issue.

2 participants