-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Add support for SX126x transceivers #24616
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
Conversation
galak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expected a west.yml update if the module is change, or support for SX126x already in loramac-node?
|
All checks are passing now. checkpatch (informational only, not a failure)Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
Yep, that's correct. The pull request can be found here: zephyrproject-rtos/loramac-node#4 I'll update this RFC when that has been merged. |
No, please update it now with |
I missed that part of the contribution guide, sorry. 🤦 I'll update the pull request right away. |
64aaa4e to
9c3d461
Compare
No worries, thank you for your PR. |
|
@andysan the reason I asked you is that there is no CI in the module repos, so we have to rely on this repository's CI to make sure the module's PR doesn't break anything. |
52ee6ed to
7ef92ec
Compare
mniestroj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks okay. I would like to test that on my custom board as soon as you rebase on current master branch.
| } | ||
| }; | ||
|
|
||
| const struct spi_buf rx_buf[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the same array of buffers for tx and rx. This would allow to drop req_rx argument. Maybe the same could be done with data_rx, because there is no case when data_tx and data_rx are passed simultaneously. In spi_nor.c and sx1276.c there is a is_write argument instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that strategy and it didn't seem to work on my nrf52 board. I suspect this is similar to an issues discussed on Slack when the sx1276 is used on that platform. I didn't debug it properly, but I think the DMA operation in the SPI peripheral gets confused when the same pointer is used in both the input and output register.
|
Please update west.yml with a SHA |
|
@Mani-Sadhasivam can you please approve if happy? |
On my TODO list. Will do it in couple of days. |
|
Further testing with the LoRaWAN patches suggests that something weird is happening. For some reason, I can’t receive downlinks correctly. Please keep this as DNM until I have investigated that. |
Turns out this was caused by the LoRaWAN stack performing SPI transactions from an interrupt context. As far as I can tell, the weird errors I was experiencing weren't caused by this driver. |
mniestroj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested LoRa shell with custom board and sx1262. Just some minor things to improve.
3c6de42 to
9cdcb37
Compare
mniestroj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed minor documentation issues in DT bindings.
mniestroj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Mani-Sadhasivam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
drivers/lora/sx126x.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Showing the IRQ line number would be helpful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rephrased this as "Could not set GPIO callback for DIO1 interrupt" I think that should be a bit clearer.
drivers/lora/sx126x.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we say, DIO1 IRQ callback not defined instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrased as "DIO1 interrupt without valid HAL IRQ callback.".
b863819 to
6fdd8f7
Compare
|
@carlescufi This should be ready to be merged now. The test issue seems unrelated ( |
Add a new configuration option, LORA_SX12XX, that is shared for all of the LoRaMAC-node-based radio drivers. By default, the appropriate driver for the LoRa radio in the device tree is included is included in the build. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
Add device tree bindings for the Semtech SX1261 and SX1262 radios. These will be used by Zephyr's LoRa drivers. Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
Add support for the SX126x series of LoRa radios using the
LoRaMAC-Node HAL.
This driver currently makes the following assumptions:
* DIO1 is used as an interrupt line.
* There is an RF switch selecting between the TX and RX ports and
that switch is controlled by DIO2.
* There is either no TCXO or the TCXO is controlled by DIO3.
Specifically, the limitations above mean that modules that use GPIOs
to control the RF switch are currently not supported. Support for such
modules would need changes to the LoRaMAC-Node code.
Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
|
Hi,Can please help to check this: It can't work property with nrf52840dk,I don't know why.There is no data from MISO, |
|
Or can please share your firmware bin file,then I can have a test. |
This pull request adds support for the SX1261 and SX1262 LoRa modems.
Due to a significant overlap between the SX1276 driver and these drives, some common functionality has been factored out into shared source files.
The current version has the following known limitations:
Testing:
The above was verified in a lab setup with an SX126X connected to an NRF52840 dev board and an SDR through a set of RF splitters and and attenuators. TTN testing was done over the air.
Dependencies:
radio: sx126x: Add Zephyr build config loramac-node#4LoRa: Add support a shell with support for CW testing #24577 for CW API changesRefactor the SX1276 driver to facilitate code reuse #25040 for the SX1276 refactor as a separate PR.