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

nRF52832 ESB Rx/Tx

Hi,

I am using 2 nRF52832, one for ESB Tx and one for ESB Rx used to send payload through UART using SDK11.

Tx board is used has a low power transmitter which transmit data on power up and shutdown after transmission as succeeded using event flag NRF_ESB_EVENT_TX_SUCCESS.

Rx board is used to retrieve those intermittent payload with event flag NRF_ESB_EVENT_RX_RECEIVED. Once a payload is received, it is send to uart via app_uart_put. This works great. The problems we have is that we require a call to nrf_esb_flush_rx after receiving the first payload, otherwise no payload will ever be received again. With the flush_rx call, the Rx works forever without trouble. In some rare occasion, we will receive 2 payload, back-to-back (normal use-case). Using the nrf_esb_flush_rx, the second payload is always drop from the rx_fifo. Why is the nrf_esb_flush_rx require ?

As a starting point, we used the esb_low_power_prx/ptx example and stripping out all the LEDs/gpio part. Prior to that, pressing a button didn't required the nrf_esb_flush_rx to works.

Attached, is the simplex prx code to reproduce the problem. prx.cpp ptx.cpp

Any help would be appreciated.

HoTiX

  • Hi. So the example code without change worked fine? Can you upload your current code to the question post?

  • I have done some testing with the ESB as well, using the esb_low_power_ptx from SDK11. The receiver side (esb_prx example) works fine every time we pressed the button to transmit. We changed the ptx code so that it transmit at boot without waiting for the button pressed. On power on both prx did receive the packet but subsequence restart of the ptx, prx no longer receives. prx only receives from fresh boot once with this scheme. The interesting part is that although it did not receive from the ptx power on but if we pressed the button to make another transmit, then the prx continues to receive. That was the problem described by OP and his solution seems to work. But we don't know the exact cause of it. I hope Nordic employee can shed a light on this.

  • Hello.

    I flashed a nRF52 DK with the esb_Iow_power_ptx example. I took the SDK11 esb_low_power_PRX example, and swapped our main.c with the prx.cpp you provided. To compile it with Keil, i had to comment out some lines:

    //extern "C" {
    //#include "app_uart.h"
    //}    
    
    // FIXME
    //#ifdef APP_ERROR_CHECK
    //#undef APP_ERROR_CHECK
    #define APP_ERROR_CHECK(err_code) if(err_code) nrf_esb_error_handler(err_code, __LINE__);
    //#endif
    

    I added some printing over RTT to see if i received packets.

    // Without this, program get stuck after first payload received.
                	//nrf_esb_flush_rx();
                    NRF_LOG_PRINTF("Received RX packet\n");
    

    I then flashed this code to a nRF52 DK. Everything works fine, i receive a packet every time i press a button on the PTX.

    So then we must take a closer look on your project.

    • Have you changed the low_power_ptx code at all? If yes, can you post it?
    • Have you changed any other files in the ESB library? For example RX fifo size or similar?

    Just some general thoughts: If received packets to not generate a callback of the event handler, it could be because of this:

    • The packet arrived while (or before) the application code handled the previous event.
    • There is already packets in the rx fifo, a new packet will not generate an event. This might be why the rx flush solves the problem, as new packets will again generate events.

    -Anders

  • I just uploaded the PTX we use to reproduce the problem. The ptx really just power up, init everything, send payload, wait for TX_SUCCESS, then shutdown. It is power on again every seconds to send another payload. These are the only file we changed.

Related