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.