I have a product that has a bug and I'm forced to go thru some older code. This was the nrf24 plus chip. The code still runs fine, and most of the function I created do all the requires steps but in an effort to narrow down problem I just can not really recall how this thing works.
if needed I can include the details in the function but I know this stiff works so trying to keep it a bit sort,. Here is some example code
enable();
sendCommand(0x60);
returnPayloadSize = sendCommand(0x00);//get payload size.
disable();
checkSum=0;
enable();
sendCommand(0x61);//read data
memset(returnNrf2Payload, 0,returnPayloadSize);
for (unsigned char d = 0; d < returnPayloadSize; d++)
{
returnNrf2Payload[d]=sendCommand(0x00);
if (d < (returnPayloadSize-1) ) checkSum ^= returnNrf2Payload[d]; //all but last.
}
disable();
that code work fine, I get my size and data comes in. Strangely my data is all zeros but that is not my main confusion.
If do this
enable();
sendCommand(0x60);
var1 = sendCommand(0x00);
disable();
enable();
sendCommand(0x61);
var2 = sendCommand(0x00);
disable();
var 1 and 2 are the same as they were before, but according to the data sheet "Payload is deleted from
FIFO after it is read" /so that can not be? I thought there was a buffer for multiple rx in but I also tried to flush and clear the rx flag, still the data persists.