-
-
Notifications
You must be signed in to change notification settings - Fork 895
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
RF24: Add 4-pin configuration support #1381
base: development
Are you sure you want to change the base?
Conversation
Running the radio in a 4-pin configuration (MISO, MOSI, SCK, CSN) with CE pin pulled to VCC, requires the driver to switch to Power Down state before entering TX or RX mode. See product specification section 6.1.1 "State diagram". For the 4-pin configuration, MY_RF24_CE_PIN has to be set to NOT_A_PIN.
There are many more places in the nRF24 driver that make use the CE-pin, e.g the RF24_sleep() function that you now call instead. This patch does not seem complete. |
You're right. So there are 3 ways to approach this issue:
Which should it be? I prefer option 2. |
But the CE pin has a function in the nRF24 communication protocol. Will the nRF24 still function correctly in all cases when tied to VCC? |
According to the specification, the CE pin is used to activate the chip in RX/TX mode. Having a look at the state diagram in chapter 6.1.1, you can see that this pin is only used to make the transition from Standby-I to TX/RX Mode (including additional transition states) and from these modes back to Standby-I by setting CE low. So if the only use of CE low is to get back to Standby-I and as an alternative it is possible to go there via the Power Down state, I believe this covers all functionality. I tested this method and it works in my setup in both RX and TX modes. Do you have other cases in mind that I didn't see? One thing I was missing is that in RF24_initialize() the pinMode should only be set in case the CE pin is not NOT_A_PIN. I will fix this as soon as we know how to go forward with this patch. |
Looking at the nRF24L01+ datasheet ("nRF24L01+ Single Chip 2.4GHz Transceiver Product Specification v1.0") it contains a number of references to toggling the CE pin, or setting it low: 6.1.5 TX mode 6.4 Received Power Detector measurements 7.4.2 Auto Retransmission (ART) ART isn't used by MySensors, and RPD is an optional function, so we can do without. However references to packet transmission always indicate a pulse on the CE pin, which isn't possible when CE is tied to VCC. |
Yeah, this configuration is definitely using the radio out of spec. It is meant to be an option for special designs with the understanding that probably not all (optional) features are available or only limited available. |
@Yveaux I would like to finish up this pull request. My plan would be:
Do you agree to proceed with the pull request this way? |
@fabyte Thanks for this patch. I've got a ESP8266 gateway which I also needed to control a number of relays and direct attached ds18b20 sensors. Due to shortage of pins, this allowed me to not require the CE pin and build my gateway. Everything seems to be working great. |
@fiskn Thanks for your feedback, good to hear that this solution works for you :) |
Could fabyte perhaps fix the build errors? I would also like this capability. |
Never mind. I see many pull requests blocked at "Toll gate (STM32F1 - Tests) — Warnings found". This makes me believe the mainline is broken which is causing pull requests on any forks to fail. |
Running the radio in a 4-pin configuration (MISO, MOSI, SCK, CSN) with
CE pin pulled to VCC, requires the driver to switch to Power Down
state before entering TX or RX mode.
See product specification section 6.1.1 "State diagram".
For the 4-pin configuration, MY_RF24_CE_PIN has to be set to
NOT_A_PIN.