I have finally made a pair of MiRF’s work. It has been a pain. There are some things that I have learned that might benefit others.
The following comments apply to the MiRF, but I believe they will generally aply to any device using a nRF2401. I am driving them with the AVR ATtiny2313 programmed with GCC.
- Timing is critical. Look on Table 19 of the data sheet, and methodically check every timing parameter against the software. The one that caused me problems was the duration of the clock strobe. I used a SetBit() followed by a ClearBit() command to pulse the strobe. I did so because the SF sample code used a similar technique. I failed to take into account the fact that the SF code was running on a PIC. The AVR is faster than the PIC. The AVR executes one instruction per machine cycle. With the internal oscillator at 8MHz, it should take 2 machine cycles or 250 nanoseconds to pulse the clock. The timing parameter for the clock duration is 500 nanoseconds.
When I finally checked the clock duration, I discovered that it was, indeed, 250 ns. I extended it with a delay between the SetBit() and the ClearBit().
Look at the timing diagrams in the datasheet and pay close attention to the device will not work if the timing is off, and it will not give you any indication why(my biggest gripe with it).
-
The data sheet tells you to clock data in and out at a rate less than 1Mbps. It uses 10kbps as an example rate, but it does not state that this is the best rate or highest rate. I was clocking data in and out at 800 kbps. I cannot say what the highest rate allowable is, but it is way slower than 800kbps. I slowed it to 10kbps and it worked.
-
The nRF2401 will do very wierd things when the timing is off. I saw it give me false DR1 indications when I was driving it too fast. I also saw mountians of false data on the DATA pin. This too, was caused by attempting to clock data in and out too fast. I would recommend starting with 10kbps. If that is too slow, slowly raise the rate and watch the chip behavior.
-
I tried using an ATMega 16 as a uC. This is a 5 volt device. I used zeeners to drop the rail voltage to 3.3v for the nRF2401. It did not like this at all. I switched to a ATtiny2313 because it will run fine at 3.3v.
Good Luck, you will need it
Jim Lake