-
Notifications
You must be signed in to change notification settings - Fork 853
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
embassy-lora Sx126xRadio
pin types
#1041
Comments
Both the nRF and STM32 HALs provide an AnyPin type you can create, i.e. using p.PB4.downgrade(). In general, I think we want to have a RadioSwitch parameter for the antenna pins at least, because it can differ from board to board. I think @ceekdee is planning to fix that. |
Ah, fair enough. I want to use it with atsamd-hal, but it has a similar DynPin API. Regarding the antenna pins, I believe my board has a single switch for both TX and RX. How is it recommended to handle that case? |
Until the API has been refactored, I think you maybe need to wrap your pin in some custom shared pin type containing an inner type with a RefCell that the driver can use. Since TX and RX is not done at the same time, it should be 'safe' to do this. It's exactly the reason I think we should use a RadioSwitch trait similar to the other drivers, because boards do it so differently. |
In the original implementation, each pin did have its own type. This seemed cumbersome and unnecessary to me, and when I realized that AnyPin could be used for both input and output pins, I changed to use CTRL and WAIT. This can certainly be re-visited as we attempt to combine MCU/Semtech chip combinations into one implementation (#1023). Any additional observations and guidance you wish to provide can be placed in issue 1023. Regarding the antenna processing, another option until the re-implementation is to make local changes to the following functions in board_specific.rs in the sx126x implementation:
to support your use case. |
@ceekdee I might have a go at introducing a RadioSwitch trait for the sx126x in a way that should help this use case, if that's ok with you. |
Would it make sense to extend the |
By other board-specific functionality, do you mean the Wait, Ready etc. pins? If so, I guess that could be there as well, though I've not seen them having different semantics across boards, vs. the radio pins which seem to vary a lot more. I'm fine either way, I think it's worth exploring. |
A brief synopsis of architectural thoughts to this point for the implementation in issue 1023. A bit premature, but I will be unavailable to work on an implementation until the end of November and want to encourage other thoughts.
|
I've moved the discussion over to #1023 now, focusing on this issue here:
I think that makes sense, maybe have a look at the stm32wl integration in embassy-lora for inspiration and see what you think. |
@ceekdee, I've gotten started a rough API that abstracts over the physical aspects of a board (view here). However while trying it out, I seem to consistently run into a bug in this function where indexing Edit: Nevermind, the bug lied within my SPI driver. |
1064: Fix LoRaWAN PHY settings for SX126x driver r=lulf a=jbeaurivage While working on #1023 / #1041, I noticed that the `lorawan_device::PhyTxRx` implementation does not conform to the LoRaWAN standard, and therefore devices using this driver could never communicate with a gateway. This PR backports the changes I've made to fix the offending parameters, and I can confirm that the driver now works with LoRaWAN networks. * Set preamble length to 8 symbols * Set polarity to inverted for received messages Co-authored-by: Justin Beaurivage <justin@wearableavionics.com>
1060: feat: embassy-usb-logger and example for rpi pico r=Dirbaio a=lulf * Add embassy-usb-logger which allows logging over USB for any device implementing embassy-usb * Add example using logger for rpi pico 1064: Fix LoRaWAN PHY settings for SX126x driver r=Dirbaio a=jbeaurivage While working on #1023 / #1041, I noticed that the `lorawan_device::PhyTxRx` implementation does not conform to the LoRaWAN standard, and therefore devices using this driver could never communicate with a gateway. This PR backports the changes I've made to fix the offending parameters, and I can confirm that the driver now works with LoRaWAN networks. * Set preamble length to 8 symbols * Set polarity to inverted for received messages Co-authored-by: Ulf Lilleengen <lulf@redhat.com> Co-authored-by: Justin Beaurivage <justin@wearableavionics.com>
1064: Fix LoRaWAN PHY settings for SX126x driver r=Dirbaio a=jbeaurivage While working on #1023 / #1041, I noticed that the `lorawan_device::PhyTxRx` implementation does not conform to the LoRaWAN standard, and therefore devices using this driver could never communicate with a gateway. This PR backports the changes I've made to fix the offending parameters, and I can confirm that the driver now works with LoRaWAN networks. * Set preamble length to 8 symbols * Set polarity to inverted for received messages Co-authored-by: Justin Beaurivage <justin@wearableavionics.com>
The original sx126x driver has been removed in favor of using the lora-phy crate. Therefore, closing this issue. |
I'm currently trying to use
Sx126xRadio
that #985 has brought. As defined here, it seems that there is only one type parameter for all output pins, and one type parameter for all interrupt-input pins:@lulf and @ceekdee, since you've worked on that PR: Unless I'm mistaken, does this mean that all the
CTRL
pins would need to have the same type, and all theWAIT
pins likewise? Would it make more sense to have a unique parameter for each of these pins?The text was updated successfully, but these errors were encountered: