Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

ESB PRX problem with sending ACK payload

Hello. I can't normally use USB for two-way communication.

The problem is sending the PRX payload in ACK packets.

After conducting a simple test: PPTX sends a packet once a second and displays its serial number on the screen, then receives a packet from PRX and outputs its serial number. There are a lot of omissions.

I noticed the following incomprehensible point in the code: the tx fifo buffer is decremented before it is used in the condition, as a result, in the presence of one payload, it will not be transmitted. If you move the decrement after the condition, then there are no confirmation packets missing.

// Pipe stays in ACK with payload until TX FIFO is empty
                        // Do not report TX success on first ack payload or retransmit
                        if (p_pipe_info->ack_payload == true && !retransmit_payload)
                        {
                            uint32_t pipe = NRF_RADIO->RXMATCH;
                            m_ack_pl_container_entry_point_pr_pipe[pipe]->in_use = false;
                            m_ack_pl_container_entry_point_pr_pipe[pipe] = (nrf_esb_payload_random_access_buf_wrapper_t *)m_ack_pl_container_entry_point_pr_pipe[pipe]->p_next;
                            
                            //--- original code -------
                            
                            //m_tx_fifo.count--;
                            
                            //----------
                            
                            if (m_tx_fifo.count > 0 && m_ack_pl_container_entry_point_pr_pipe[pipe] != 0)
                            {
                                 mp_current_payload = m_ack_pl_container_entry_point_pr_pipe[pipe]->p_payload;
                            }
                            else mp_current_payload = 0;
                            
                            //----- my code ------
                            
                            m_tx_fifo.count--;
                            
                            //---------------
                            
                            // ACK payloads also require TX_DS
                            // (page 40 of the 'nRF24LE1_Product_Specification_rev1_6.pdf').
                            m_interrupt_flags |= NRF_ESB_INT_TX_SUCCESS_MSK;
                        }
I did the right thing by transferring this line of code, will it affect other parts of the ESB?

It is also unclear how to reset the TX FIFO for PRX, since m_acc_pl_container.in_use remain busy, as a result, the entire connection collapses when working with multiple PIPES.

  • Thank you so much for your reply. The ESB library is not so easy to understand, especially in the issue of package maintenance with AK, so I could not formulate the problem very precisely. You have formulated it very precisely. As I already wrote, I seem to have managed to find workarounds for the problem under discussion in the NRF SDK library. I can't immediately understand the code you offer and test it due to my heavy employment. As soon as I have time, I will definitely test your proposed ESB implementation.

  • Hi 

    I agree it is a bit tricky to follow the flow of the protocol. One of the things that complicate the ACK payload procedure is that you are not allowed to remove an ACK payload from the FIFO or trigger the TX interrupt on the PRX side until you receive the next packet from the PTX (with different PID and CRC). 

    The reason for this is that as long as you just receive the same packet from the PTX (same PID and CRC) you must assume that the PTX has not received any ACK's, and you have to retransmit the same ACK over and over. 

    The code you altered should only run once the PRX receives the next packet from the PTX, at which point it will decrement the tx_fifo counter and check if there is a second packet in the TX FIFO that needs to be included in the ACK packet. 

    If you have any issues integrating the patched library just let me know. The API is the same, so integrating it should be relatively straight forward. 

    Best regards
    Torbjørn

Related