This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to check if nRF24L01 (nrf24) is working correctly in real-time?

PROBLEM:

My nRF24L01 transceiver occasionally stops working (about every 2 minutes) when receiving and transmitting data packets.

I found that when the power supply occasionally drops below 3.3V for a 0.10 second duration and then comes back to normal 3.3V -- the nRF24L01 transceiver stops working.

However, once the transceiver stops working, my firmware currently does not attempt to restart the transceiver. 

GOAL:

I want to be able to detect when the nRF24L01transceiver has stopped working in real-time, and re-initialize the transceiver registers for a full startup.

I do not want to fix the fluctuations in the power supply as this is beyond my development scope. 

Rather, I want the firmware to detect when the transceiver has stopped working, and re-initialize the transceiver registers and re-start the transceiver for normal operation.

Ideally, I would like to read a NAME ID code or fixed value from the nRF24L01 transceiver that identifies if the transceiver is functioning properly. 

I looked at the Status register, but all of the bits seem to be dynamic -- indicating when the read buffer is full,etc.  Whereby, I cannot see how status can help me detect a transceiver failure.

The firmware current reads the nRF24L01 status register at startup and it always returns 0x0E value indicating the transceiver has successfully started.

However, when the transceiver is running, the status register also returns flags related to read/write buffer full state.  And thereby, corrupting the 0x0E value state.

What is the solution? 

Thanks,

Ken Huebner

Software Engineer

Huebner Design

 

Parents
  • Hi,

    It would be interesting to read out all the registers when the issue occurs, to check if the registers go back to the default power on values given in the register map of the nRF24L01P. If that is the case you may just periodically read one of the address registers to check if the content is switched, and then re-init the radio. Alternatively you may also periodically re-init the radio by having a timeout if no packet is received/sent within what your application expect.

    Kenneth

  • Hi Ken,

    I solved the problem by periodically (every 1/4 second) doing a re-init of the nRF24L01 transceiver during a quiescent state.  

    This code below tested OK and works great. 

    For Testing: I forced a multiple brownouts of the power supply to the transceiver down to 2.7V or so, then brought power back up to 3.3V Wherein the transceiver SPI lines would consistently freeze. 

    But after the code below was implemented and the transceiver was periodically re-init, the freeze NO longer happened.  Works great.

    This code was included at the top of the re-init function prior to normal configuration and transceiver power up. 


        // RESET TRANSCEIVER CHIP...
        // ==========================
        /*
        At every reset, do the following steps:
        1)use power down mode (PWR_UP = 0)
        2)clear data ready flag and data sent flag in status register
        3)flush tx/rx buffer
        4)write status register as 0x0e;
        */
        // put chip in standby mode to deactivate any transmit/receive operation.
        rfMessageCHIP_CE_set_STANDBY();

        // set chip PWR_UP=0 for power down.
        // Enable PRIM_RX, PWR_UP=0 for power down, CRC(1byte), RX_DR, IRQ pins inactive.  WORKS OK 2013-4-24.
        rfMessageCHIP_WriteReg(NRF24L01_REG_CONFIG, 0b01111001);

        // clear status register: data read flag and data sent flag.
        //rfMessageCHIP_WriteReg_Status( 0b01100000);
        // clear all interrupt flags
        rfMessageCHIP_WriteReg_Status( NRF24L01_STATUS_CLEAR_ALL_FLAGS);

        // clean out transmit/receive data buffers.
        rfMessageCHIP_WriteCommand(NRF24L01_CMD_FLUSH_RX);
        rrfMessageCHIP_WriteCommand(NRF24L01_CMD_FLUSH_TX);

        // write status register: 0x0e
        //rfMessageCHIP_WriteReg_Status(0x0e);
        // clear all interrupt flags
        rfMessageCHIP_WriteReg_Status( NRF24L01_STATUS_CLEAR_ALL_FLAGS);



Reply
  • Hi Ken,

    I solved the problem by periodically (every 1/4 second) doing a re-init of the nRF24L01 transceiver during a quiescent state.  

    This code below tested OK and works great. 

    For Testing: I forced a multiple brownouts of the power supply to the transceiver down to 2.7V or so, then brought power back up to 3.3V Wherein the transceiver SPI lines would consistently freeze. 

    But after the code below was implemented and the transceiver was periodically re-init, the freeze NO longer happened.  Works great.

    This code was included at the top of the re-init function prior to normal configuration and transceiver power up. 


        // RESET TRANSCEIVER CHIP...
        // ==========================
        /*
        At every reset, do the following steps:
        1)use power down mode (PWR_UP = 0)
        2)clear data ready flag and data sent flag in status register
        3)flush tx/rx buffer
        4)write status register as 0x0e;
        */
        // put chip in standby mode to deactivate any transmit/receive operation.
        rfMessageCHIP_CE_set_STANDBY();

        // set chip PWR_UP=0 for power down.
        // Enable PRIM_RX, PWR_UP=0 for power down, CRC(1byte), RX_DR, IRQ pins inactive.  WORKS OK 2013-4-24.
        rfMessageCHIP_WriteReg(NRF24L01_REG_CONFIG, 0b01111001);

        // clear status register: data read flag and data sent flag.
        //rfMessageCHIP_WriteReg_Status( 0b01100000);
        // clear all interrupt flags
        rfMessageCHIP_WriteReg_Status( NRF24L01_STATUS_CLEAR_ALL_FLAGS);

        // clean out transmit/receive data buffers.
        rfMessageCHIP_WriteCommand(NRF24L01_CMD_FLUSH_RX);
        rrfMessageCHIP_WriteCommand(NRF24L01_CMD_FLUSH_TX);

        // write status register: 0x0e
        //rfMessageCHIP_WriteReg_Status(0x0e);
        // clear all interrupt flags
        rfMessageCHIP_WriteReg_Status( NRF24L01_STATUS_CLEAR_ALL_FLAGS);



Children
Related