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

lora: Multiple small fixes (including syncword, sx126x minimum config) #804

Merged
merged 5 commits into from
Feb 20, 2024

Conversation

projectgus
Copy link
Contributor

@projectgus projectgus commented Feb 13, 2024

Collection of small LoRa fixes in individual commits. See commit messages for more details.

  • SX126x: Fix invalid configuration after reset. Configuring with the documented minimal lora_cfg didn't produce the documented results, some configuration keys always needed to be set.
  • SX126x: Fix syncword setting. Closes LoRa Driver SX126x does not set SyncWord #796.
  • SX127x: Fix syncword setting. Implementation was simply missing. 🤦
  • lora-sync: Fix a possible race where a send which failed immediately (or completed very quickly) would not return immediately.
  • SX126x: Cosmetic clean up of some struct formatting.

Test on SX1276, SX1262, STM32WL55.

@projectgus projectgus force-pushed the bugfix/lora_sx126x branch 2 times, most recently from 45478af to 7a354cd Compare February 13, 2024 05:56
@projectgus
Copy link
Contributor Author

Build failure looks to be an unrelated regression from micropython/micropython#13620

@projectgus projectgus changed the title lora: Multiple small fixes lora: Multiple small fixes (including syncword, sx126x minimum config) Feb 13, 2024
@projectgus
Copy link
Contributor Author

@oeysteinhansen If you have the opportunity, then it's possible to install the packages from this PR and verify the fix by running mpremote mip install --index https://projectgus.github.io/micropython-lib/mip/bugfix/lora_sx126x lora-sx126x

According to the docs, only freq_khz was needed for working output.
However:

- Without output_power setting, no output from SX1262 antenna (theory:
  output routed to the SX1261 antenna).

- SF,BW,etc. settings were different from the SX127x power on defaults, so
  modems with an identical configuration were unable to communicate.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
If send completes before the first call to poll_send(), the driver could
get stuck in _sync_wait(). This had much less impact before rp2 port went
tickless, as _sync_wait(will_irq=True) calls machine.idle() which may not
wake very frequently on a tickless port.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Fixes issue micropython#796.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Changes are cosmetic - and maybe very minor code size - but not functional.
_reg_read() was calling struct.packinto() with an incorrect number of
arguments but it seems like MicroPython didn't mind, as result is correct
for both versions.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
@dpgeorge dpgeorge merged commit 2242465 into micropython:master Feb 20, 2024
3 checks passed
@dpgeorge
Copy link
Member

Thanks, merged with relevant manifest.py versions bumped at patch level.

@projectgus
Copy link
Contributor Author

@dpgeorge Oops, good catch - thanks!

@projectgus projectgus deleted the bugfix/lora_sx126x branch February 20, 2024 22:54
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.

LoRa Driver SX126x does not set SyncWord
2 participants