Re: Frequency hopping experiments on the NRF24
Posted: 27 May 2020, 10:33
Hi Max, thats exactly right.
To explain, the ce and csn pins can be on any digital pins, so most examples you see are different, whatever the author chose. In my case I chose 9 for ce and 10 for csn, to keep all the pins adjacent.
This was an unfortunate choice, as when we discovered the RF-Nano, it was the opposite, 10 for ce and 9 for csn. I strongly suggest we stick with the RF-Nano convention, but I'd already made several radios by then, hence the two options in the code. I will remove the 'old' reference.
That diagram above is in the RF-Nano order Max, CE on 10 and CSN on 9. the opposite of how I set up the very original project. For an RF-Nano it has to be this way, its hard wired, so to create an instance use:
RF24 radio(10,9); // ce, csn
I would use this for any new builds, but I still have four radios with
RF24 radio(9,10); // ce, csn
Crucially of course the wiring has to match the code, in the case of the RF-Nano its already wired,
but to update my working car radios to 'RF-Nano order' means dismantling and rewiring.
Getting ce and csn mixed up does no harm, it wont break anything
A bit of an update, two things:
The OS was a bit of a temporary installation, in fact the NRF+PA module was just wedged in place for the tests, but just this morning I got around to fitting it properly - and discovered something - it doesnt like the brass SMA connector to be grounded to the metal case. I tried insulated and grounded several times to confirm this, because its not what you'd expect. Insulated its fine, but when grounded I saw significant packet losses. This suggests that whilst the brass RF output connector is DC connected to ground, from an RF perspective its not a perfectly unbalanced feed as it theoretically should be. These things are not a problem once you know, so its now temporarily mounted through a plastic spacer and its fine. So its still not permanent! I'd not seen this peculiarity on the Multiplex Pico as its a plastic case.
Something to remember.
The other thing is I had one receiver lock up when running from the same supply as a noisy brushed DC motor, and I'm almost sure its the NRF that locks rather than the 328P, they do seem to be very sensitive to power supply variations/noise. So I've added 100uF and a 100nf in parallel across the RF-Nano power supply, actually on the receiver. This is whats recommended for the NRF anyway and isnt a surprise, and after repeatedly subjecting it to lots of electrical noise I cant get it to do it again so I believe thats sorted. All my PIC stuff has a watchdog timer, I'll look into adding one here too, though resetting the 328P wont reset the NRF24 so a WDT may not be of any benefit.
Cheers
Phil
To explain, the ce and csn pins can be on any digital pins, so most examples you see are different, whatever the author chose. In my case I chose 9 for ce and 10 for csn, to keep all the pins adjacent.
This was an unfortunate choice, as when we discovered the RF-Nano, it was the opposite, 10 for ce and 9 for csn. I strongly suggest we stick with the RF-Nano convention, but I'd already made several radios by then, hence the two options in the code. I will remove the 'old' reference.
That diagram above is in the RF-Nano order Max, CE on 10 and CSN on 9. the opposite of how I set up the very original project. For an RF-Nano it has to be this way, its hard wired, so to create an instance use:
RF24 radio(10,9); // ce, csn
I would use this for any new builds, but I still have four radios with
RF24 radio(9,10); // ce, csn
Crucially of course the wiring has to match the code, in the case of the RF-Nano its already wired,
but to update my working car radios to 'RF-Nano order' means dismantling and rewiring.
Getting ce and csn mixed up does no harm, it wont break anything

A bit of an update, two things:
The OS was a bit of a temporary installation, in fact the NRF+PA module was just wedged in place for the tests, but just this morning I got around to fitting it properly - and discovered something - it doesnt like the brass SMA connector to be grounded to the metal case. I tried insulated and grounded several times to confirm this, because its not what you'd expect. Insulated its fine, but when grounded I saw significant packet losses. This suggests that whilst the brass RF output connector is DC connected to ground, from an RF perspective its not a perfectly unbalanced feed as it theoretically should be. These things are not a problem once you know, so its now temporarily mounted through a plastic spacer and its fine. So its still not permanent! I'd not seen this peculiarity on the Multiplex Pico as its a plastic case.
Something to remember.
The other thing is I had one receiver lock up when running from the same supply as a noisy brushed DC motor, and I'm almost sure its the NRF that locks rather than the 328P, they do seem to be very sensitive to power supply variations/noise. So I've added 100uF and a 100nf in parallel across the RF-Nano power supply, actually on the receiver. This is whats recommended for the NRF anyway and isnt a surprise, and after repeatedly subjecting it to lots of electrical noise I cant get it to do it again so I believe thats sorted. All my PIC stuff has a watchdog timer, I'll look into adding one here too, though resetting the 328P wont reset the NRF24 so a WDT may not be of any benefit.
Cheers
Phil