Skip to content

[WIP] Add Waveshare Pico-LoRa-SX1262-868M support #15

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ThomasLeister
Copy link
Contributor

@ThomasLeister ThomasLeister commented Jan 12, 2022

This PR is for adding Pico-LoRa-SX1262-868M support.

Waveshare module:

The module manufacturer has modified the lorawan-library-for-pico to be compatible to the Waveshare module but has not merged back their changes. The original source is available here: ZIP | GitHub . Unfortunately everything is crowded into one commit and SX1276 support seems to be broken in favor of SX1262 support.

I've taken the manufacturer's sources (also BSD-3 clause licensed) and ported the important parts on top of a recent version of the upstream library. Also some updates on README.md have been done and updated example applications include a proper pin configuration struct for the Waveshare module. A compile time switch in CMakeLists.txt lets the user decide between SX1276 and SX1262 support.

SX1267 should not be broken, but working support for the chip is still unconfirmed, because I'm just owning a Waveshare module ;-)

To be done prior to merging this PR:

  • Check if SX1276 support is still working properly (it is still the default for this library)
  • Check if all example applications work for SX1262 - so far only otaa_temperature_led has been tested.
  • Maybe revisit the CMake switch mechanism. Maybe there's a better solution?
  • Check the problem with eeprom (original commit e31d3c1). The Pico does get stuck in "Duty cycle restricted" when that commit in included. If it is reverted / removed, the join process does work fine. Maybe related to Raspberry Pi Pico with SX1276 does not join The Things Network - "Duty Cycle restricted" #14 ?

I'd be happy to get your opinion, @sandeepmistry . Let me know your opinion and suggestions and make this branch / PR ready for merge :-)

…xamples:

	- hello_abp
	- hello_otaa examples
	- otaa_temperature_led
Read back information from cache instead of flash.
The cache contains  the latest context, whereas
the flash is only updated periodically.

This could cause issues if the flash is not (yet) updated
while the context has been updated in the meantime and values are read
by LoRaMAC.

Therefore just read from flash initially after startup (EepromMcuInit())
and rely on write cache later.

This commit effectively makes commit  e31d3c1
work for me and therefore is a fix. Previous attemps to use commit
e31d3c1... without this commit failed. Error message: "Duty cycle restricted".

The error message might not appear at the first startup, but will
appear if Raspberry Pi Pico is restarted and values from "EEPROM" /
Flash have been read.
@ThomasLeister
Copy link
Contributor Author

Eeprom problem seems to be fixed via #16

@ThomasLeister ThomasLeister force-pushed the add-waveshare-sx1262-support branch from 9ca0775 to 5726f72 Compare January 16, 2022 15:42
@ThomasLeister
Copy link
Contributor Author

ThomasLeister commented Jan 16, 2022

  • Removed the "Revert "Use board's last flash sector for eeprom storage" commit (force push!) => (EEPROM / Flash active, again.
  • Merged my eeprom fix to this branch

@ep1cman
Copy link
Contributor

ep1cman commented Jan 18, 2022

Can confirm SX1276 works as expected as the default

@ThomasLeister ThomasLeister changed the title Add Waveshare Pico-LoRa-SX1262-868M support [WIP] Add Waveshare Pico-LoRa-SX1262-868M support Jan 23, 2022
@sandeepmistry
Copy link
Member

@ThomasLeister thank you for the pull request, and sorry for the delay.

We are still thinking about if the SX1262 is something we want to support in this library, and then I would have to get one that is supported for the US915 my testing.

In regards to your comment:

Maybe revisit the CMake switch mechanism. Maybe there's a better solution?

Since most RP2040 boards have ample flash space, I'm wondering if the small wrapper around the Semtech library could be used to auto detect the module version on init?

@ThomasLeister
Copy link
Contributor Author

Sure, take your time to evaluate if this module should be supported by the library. If not, no worries. Then I'll just keep this branch in my personal repo.

As far as I have seen, there is no such WaveShare module available for regions other than Eu868. I just send WaveShare a message to get some information on their future plans. Maybe there will be US versions some day?

@ThomasLeister
Copy link
Contributor Author

I have an update for you. The WaveShare support just replied to my mail:

Our engineer replied that the US915 and EU433 versions will be launched soon.

Sounds good! :)

@ThomasLeister
Copy link
Contributor Author

Waveshare modules for EU868, US915 and EU433 are now available! https://www.waveshare.com/pico-lora-sx1262-868m.htm 👏

@gomond
Copy link

gomond commented Jul 21, 2022

The EU868 module works OK on US915 / AU915 just with minor power loss but well suitable for testing purposes.

@kaspar-nl
Copy link

Thank you so much for this branch. Hereby the confirmation that the following configuration works:

  • Waveshare Pico-LoRa-SX1262-868M
  • Raspberry Pi Pico WH

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.

5 participants