-
Notifications
You must be signed in to change notification settings - Fork 27
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
Compatibility with RF24 library #54
Comments
Thanks for sharing this information. I'd love to add this into the library and wondered if you could provide detail on how to come up with the pipe addresses since I'm sure people would like that information. Also, for the RPi connection to the radio did the pin numbers detailed on http://tmrh20.github.io/RF24/ work ok?
|
Address informationBasic_TXconst static uint8_t RADIO_ID = 1; // Our radio's id. printDetails( ) shows: RX_ADDR_P1 1,2,3,4,1 Basic_RXconst static uint8_t RADIO_ID = 0; // Our radio's id. The transmitter will send to this id. printDetails( ) shows: RX_ADDR_P1 1,2,3,4,0 RF24_TXconst static uint8_t RADIO_ID = 0; // Our radio's id. The transmitter will send to this id. printDetails( ) shows: RX_ADDR_P0-1 = 0x0004030201 0x0104030201 Be aware of address differences: RF24 from right to left. First (most left one) correspond with configurable value in NRFLite RPI used pins and relation with python script/outputThe RPI pin numbering I used in the python file is not header pin 25 but the GPIO 25 which corresponds with header pin 22. At startup of the python file CSN/CE and used addresses is reported: |
Doug asks:
Take a look at the files @tong67 provided above. He figured out how to make the micropython version of the RF24 library transmit to a receiver running NRFLite, so you could use it as a starting point for reversing the direction. Unfortunately I don't have an ESP to experiment with so don't have the exact code you need, but you'll see the addresses, dynamic payload, ack settings, retries, and the like are all being setup in his code. The addresses might be the most complicated part. You have to convert the "1, 2, 3, 4, radioId" to hex and reverse the order of each value to get an equivalent address for the RF24 library. Here is an example. NRFLite internal address array format = {1, 2, 3, 4, radioId} On the receiver side, place the address into pipe 1 and on the NRFLite transmitter side, send data to the equivalent radio Id of that address. This is my best guess for micropython:
|
Hi, ` cfg = {"spi": 1, "miso": 12, "mosi": 13, "sck": 14, "csn": 4, "ce": 2} csn = Pin(cfg["csn"], mode=Pin.OUT, value=1) print("Initializing NRF ...") nrf.open_rx_pipe(1, pipes[0]) print("NRFlite receive test, waiting for packets... (ctrl-C to stop)") while True: Modified NRF24L01 imported above: `
` |
I don't believe the retry settings are needed on the RX side but am not 100% certain since I have never tested things without it. Is there a way for you to print out all the nRF24L01's registers? That might make it easier to identify the problem. |
I can probably figure some way to do this in micropython. I'd like to match the output from the printDetails(). How do I enable debug/Serial output for NRFlite? it looks like there are two #define statements related to _serial, but my C++/Arduino skills are rusty. |
When you create the radio object, pass in a Serial object as mentioned here and there's an example of this on ChannelScanner line 33. printDetails calls printRegister which references the debugln define which ultimately uses this serial object. |
Thank you for the pointer on setting the Serial up.
open_rx_pipe(1,b"\x01\x02\x03\x04\x00") I thought I had tried that, but to be honest, I went through so many iterations of things, I've lost track. Thanks for helping me figure this out, I learned at lot about SPI and the NRF module! |
Sorry for the delay but congrats on getting things to work. Hope the rest of the project is a little easier and happy holidays! |
I needed multiple free pins with ATtiny85 so used the NRFLite 2 pins solution for Rx. The Tx needed to be run in conjunction with a RPI which is supported with nRF24 library (https://github.com/nRF24/RF24). To used the default of NRFLite, the RF24 has to configured with set of settings. This combines advantages of both worlds. It might be usefull for other users as well so might be added to the readme. Required settings:
const uint64_t pipes[2] = { 0x0004030201LL, 0x0104030201LL };
radio.setChannel(100); // channel 100
radio.setPALevel(RF24_PA_MAX); // MAX power
radio.setDataRate(RF24_2MBPS); // 2MBPS
radio.setRetries(1, 15); // 250+1*250us delay, 15 retries
radio.enableDynamicAck(); // Enable auto ack
radio.enableAckPayload(); // enable payload with ack and dynamic payload length
radio.setCRCLength(RF24_CRC_8); // CRC8
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1, pipes[1]);
radio.write(&_radioData, sizeof(_radioData), true)
Attached sketch of Basic_TX based on RF24 library which works with Basic_RX.
Same Basic_TX but now as python script run on RPI
Basic_TX_RF24.ino.txt
Basic_TX.py.txt
The text was updated successfully, but these errors were encountered: