Skip to content
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

A public method to check if the chip is connected #272

Closed
wmarkow opened this issue Jul 19, 2016 · 8 comments
Closed

A public method to check if the chip is connected #272

wmarkow opened this issue Jul 19, 2016 · 8 comments

Comments

@wmarkow
Copy link
Contributor

wmarkow commented Jul 19, 2016

Would it be a good enhancement to expose a public method that will check if the nRF24 chip is connected to the SPI bus and powered on?
As discussed in #213, when the chip is not connected (or is damaged or so) then SPI reads mostly 0x00 or 0xFF value from it. To check if the chip is really connected and running we could read the value of some specific register. By some specific register I mean the register that we know for sure that its value MUST be different than 0x00 or 0xFF. We could use a SETUP_AW register as according to the specs its value will never be 0x00 nor 0xFF:

SETUP_AW = 0b000000xx,
where
xx is 01 or 11 or 10 
xx = 00 is illegal

I would appreciate that method (like bool RF24::isChipConnected()) as it will make it easier to check if chip is connected without calling the begin() again.

@TMRh20
Copy link
Member

TMRh20 commented Jul 24, 2016

I don't see much harm in something like this, except would it be useful to include it in the isValid() function?

wmarkow added a commit to wmarkow/RF24 that referenced this issue Sep 30, 2016
@Krastanov
Copy link

I have started using this patch for my work. It would be great if it could be accepted in the official version.

@MDM63
Copy link

MDM63 commented Dec 6, 2016

This would have saved me great deal of time and work. Would be good addition in the library.

@wmarkow
Copy link
Contributor Author

wmarkow commented May 4, 2017

Pull request has been accepted and merged.

@wmarkow wmarkow closed this as completed May 4, 2017
@ortegafernando
Copy link

Hi, when could you use this function? I mean, I always configure all the stuff arround RF24 in my SETUP. But I don't know if you could check in the LOOP part if "isChipConnected" and if it is not, reset it (may be mosfet) and reconfigure it again.

An example will be great, thanks.

@soligen2010
Copy link
Contributor

I use it in setup only to see if the chip is connected. Chips wouldn't normally get connected/disconnected while the program runs.

For example, I have the option to have one or two connected for optional diversity. In setup I check for both, then use whichever one is present, or use both for receiver diversity if they both exist. This way I don't have to edit code for the various configurations I support.

@ortegafernando
Copy link

Chips wouldn't normally get connected/disconnected while the program runs.

Sometimes I get my module "blocked" so I thought that with this new function I could check if it is "death" or "alive". I think my problem has another source, hasn't it ?

@soligen2010
Copy link
Contributor

soligen2010 commented Oct 10, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants