-
Notifications
You must be signed in to change notification settings - Fork 13
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
IEEE 802.15.4 implementation #11
Comments
Hey, interesting question! This is one of my goals for the radio drivers, however, (afaik) the At the moment it's mostly an experiment in how to effectively abstract different LPWAN components in rust, but, there's a working / extremely minimal Feel free to open an issue over there if you'd be interested in working on this! (or, sponsoring third-party work on it I guess). I've been putting off a bit of a cleanup of the repo and work breakdown because so far it's only me, and would be happy to coach / guide / support improvements. |
I have also a very crude ieee802.15.4 mac in progress, so far it only supports sending/handling associate, ACK and data commands. The problem I am running into is that doing this without any sort of framework means a lot of complex state machines to keep track of, and the MAC constantly needs to babysit the PHY layer (check_receive/check_transmit are in my case timing sensitive since they manage filling/draining of the radio FIFO "on the fly"). I am thinking of moving to a message passing model and letting the PHY layer (and also the MAC layer) be interrupt driven, but that isn't very compatible with the current radio-hal (and I have not yet had time to design an interrupt driven alternative). The alternative API would be something on the order of I hope to OS this when I start to converge on something (well, as soon as my employer allows me to). |
unfortunately in my experience this is always the case with the PHY/MAC (and yeah ideally they need to be interrupt driven but, i haven't found a useful way to abstract this in the PHY yet).
this is similar to my intent with the
the trick here is that you need to associate the lifetime of the buffer with the lifetime of the TX/RX/whatever operation. this is basically how the non-blocking impl works, which does probably this is as simple as removing the automatic implementation to make it opt-in in the same manner as the embedded-hal traits, then it would be reasonably straightforward to directly implement the do you think an approach like that solve the problems you're experiencing? |
So far I never managed to keep the rx/tx buffers in the MAC, I have a single 256b buffer in the PHY because start_transmit only gives me access to the send buffer once (and I need somewhere to write data during check_receive). Given that the radio can anyway only do one operation at a time, it isn't such a big deal. Still, it would be nicer if the MAC just gave "send this data" / "call me on received data" instructions to the PHY and the latter handled the state transitions. Some PHY (e.g. the semtech chips) have support for "auto modes" which allow to do some of the state transitions directly on the hardware. Obvoiusly this means I have a fair amount of memcpy in my code, if that becomes a problem then I would probably prefer to pass the Frame object directly to the PHY and let the latter do the serialization into the tx buffer (abstracted by e.g. an I will have to take a closer look at the non-blocking traits, it is indeed elegant to let the caller allocate all the radio buffers. The drawback is that you might end up initializing new buffers for each sent packet (since it is not clear to me how you could transfer ownership of the buffer back to the caller when e.g. the |
this all works really nicely with async
on thinking more this seems like a really nice solution! the radio constructor could take a buffer |
@ryankurte @henrikssn thanks! All this looks quite interesting. |
This is what I have at the moment:
The network looks like this:
So far I am very happy with this setup, I have a temp sensor node powered by a coin cell which should (from power measurements) deliver sensor data to my home automation for multiple years without battery change. Next level would be to implement beaconing so that it is possible to do bidirectional communication with sleeping nodes (right now you need to wait until the node decides to wake up). If anyone is interested in cooperating on this I can try to cleanup and publish the code. |
I'm looking into somewhat similar as discussed in #6 (a prototype that relies on OpenThread for communication, based on NRF52*).
Can https://github.com/braun-embedded/rust-ieee802.15.4 be used with radio-hal or at least some effort coordinated?
The text was updated successfully, but these errors were encountered: