almusil / rfm69

A generic rust driver to support RFM69 family wireless chips.
Apache License 2.0
9 stars 9 forks source link

allow sending and receiving large packets #22

Closed rkreis closed 3 years ago

rkreis commented 3 years ago

So here's an attempt to implement send/recv for large packets (#18). I tested it with all packet lengths from 1 to 144 bytes, but of course the FIFO threshold, bitrate, SPI clock and latency will have an influence. A few issues remain:

Do you think these can be overcome and we can merge it? With the public register access methods, this could also be nicely implemented in the application code. What are your thoughts?

rkreis commented 3 years ago

I chose not to use with_timeout because the 1ms delay between polls would make FIFO overruns (or underruns) much more likely. I would just like a nicer timeout that's not tied to the SPI data rate and latency, but we don't have a timer we can query, do we?If you're ok with including this, let's get it done as nicely as we can. I'll do some more testing over the next week or so to get the RX as robust as possible. Might even switch over to "unlimited" packet format because it could simplify RX handling - as far as I can tell, the FIFO will always get filled then, and something like a failed CRC check can't get us stuck waiting for FifoThreshold || PayloadReady. Generally, I think the hardware interface is a little awkward there.

rkreis commented 3 years ago

I switched it to a very simple byte-by-byte implementation because I had some reliability issues. This also has a simpler interface. SyncAddressMatch and PayloadReady are not used at all anymore. The reason for requiring the Variable(255) packet format is to disable packet length filtering. With these filters, the length byte is still inserted into the FIFO, even when the rest of the packet is not received. If broadcast is not needed, address filtering could be done using the SyncWord.

Open issues:

rkreis commented 3 years ago