Closed Martincic closed 3 years ago
master_fifo()
had much better performance on a RPi compared to master()
in the streaming _test.py BTW, data_rate is in bits per second, not bytes per seconds. Turning off auto-ack will most definitely cause data loss, especially for that much data being streamed so quickly.
I can tell by the code you posted, you're using the speed boost included with v2.0.0. I'm sorry, but if you're looking for speed, then python isn't your best friend. Try using TMRh20's RF24 library, which is much faster because its written in C++ (comes also with a python wrapper that is just as fast as C++).
I recently (& coincidentally) made a refactoring change (on my dev branch) that would allow passing in whatever spi
/csn
/ce_pin
objects you want as long as there's a new HWMixin
class that can take exactly the objects you passed.
In short, I think this library is starting to outgrow just circuitpython. In the future I may be able to support the popular ~pigpio
,~ RPi.GPIO
+ spidev
, etc... (not to mention more native support for MicroPython). This also opens up an opportunity to offer NerdRalph's 3 and 4 pin solutions.
update from my dev branch testing: I've been testing the library on RPi2 and RPi4 using spidev
(written in C; wrapped into python) instead of Adafruit's busio
for SPI implementation. Consequently, I've started using GPIO8 for the CSN pin (on the default SPI bus) because its faster to let the spidev kernel manage that.
master()
from stream_test.py. (on 1Mbps data_rate
)Test result sending a large-ish (1.24 MB) file from RPi4 to RPi2:
1307379 bytes split into 40857 payloads Transmission took 56.005716284999835 s successfully sent 100.0% (40857/40857) of LogoLarge.xcf
Mirrored test sending the same file to RPi4 from RPi2:
1307379 bytes split into 40857 payloads Transmission took 55.499714189999395 s successfully sent 100.0% (40857/40857) of LogoLarge.xcf
I have made a few small code changes that should speed things up, but using spidev
seems to be the best speed-up. I doubt it would take more than 5 minutes to transfer a 2.5 MB file now 🎉 (upon next release). Also, I have not verified data is un-corrupted on RX side.
Problem
I am aware of nrf240L1+ module is capable of 2mb/s speeds and I pretty sure both of my raspberry pi's on each end can handle them, but the actual transfer time is 40 minutes to send a 2.6Mb file. Could this be faster in some way, what am I missing?
How
I'm trying to stream an image from one NRF240L+ module to another and the current setup is only a couple of meters apart pointing directly at each other. I am using your example (nrf24l01_stream_test) which I've modified in the following manner:
This is working with some data loss and image disruption which is precisely what I need. I tried manually setting the speed to 2Mb/s and turning off auto_ack but it had no noticeable effect.
Transmission log
Code
make_buffers()
slave()