CE -- Do you really need to set low to do R_RX_PAYLOAD?

Discussion about wireless devices

CE -- Do you really need to set low to do R_RX_PAYLOAD?

Postby davethomaspilot » Tue Oct 18, 2011 2:59 pm

I'm chasing some intermittent problems with hardware that interfaces with NRF24L01 chips, so I've been reviewing my firmware.

Tutorial 0 on this website ays:

... R_RX_PAYLOAD. This
operation allows you to read the contents of the RX FIFO if you have received a packet
(when you are in RX mode), which is generally signaled by the RX_DR interrupt. Using
this operation is a little more involved than the others, because it requires you to also use
CE.
When you are receiving packets, CE is held high. Once you have received a
packet you MUST bring CE low to disable the receiver, and then you execute the
R_RX_PAYLOAD operation...



Is it really necessary to power off the RF front end to receive a payload? I can't find anything in the NRF24L01 spec that says you must use CE to do a R_RX_PAYLOAD.

I've been using a code fragment for reading received payloads for some time and it seems to work without bringing CE low to receive the payload. I now use two receivers for frequency diversity, so it would be convenient to just leave CE high while I read received payloads, selecting the receiver with the appropriate CSN input.

I posted a similar question on the SparkFun Forum, since their example receiver code does not set CE low when receiving payloads:

Thanks,

Dave Thomas
Thanks,

Dave Thomas
davethomaspilot
 
Posts: 34
Joined: Wed Jan 27, 2010 7:16 pm

Re: CE -- Do you really need to set low to do R_RX_PAYLOAD?

Postby brennen » Tue Oct 18, 2011 7:29 pm

Technically it is not required to drop CE before reading a payload. However, if you read the payload while CE is still high, the L01 *will not* remove it from the RX FIFO (as I recall, at least). This required me to flush the RX FIFO on a read, and if a packet happens to come in while you're flushing the FIFO, you lose that data. I may be wrong here, as I wrote that like 4 years ago. :)

The Sparkun example I'm looking at *does* drop CE while it reads out RX payloads. Note CE = 0 and CE = 1 below:

Code: Select all
//This will clock out the current payload into the data_array
void receive_data(void)
{
    uns8 i, j, temp;

    CE = 0;//Power down RF Front end

    //Erase the current data array so that we know we are looking at actual received data
    data_array[0] = 0x00;
   

    //Clock in data, we are setup for 32-bit payloads
    for(i = 0 ; i < 4 ; i++) //4 bytes
    {
        for(j = 0 ; j < 8 ; j++) //8 bits each
        {
            temp <<= 1;
            temp.0 = DATA1;

            CLK1 = 1;
            CLK1 = 0;
        }

        data_array[i] = temp; //Store this byte
    }
   
   

    CE = 1; //Power up RF Front end
}
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm


Return to Wireless

Who is online

Users browsing this forum: No registered users and 2 guests

cron