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

Double direction communication problem in ESB protocol (PTX --> PRX --> PTX)

Hey,

I have two nrf52 development board. One is PRX, one is PTX. I try to realize the scenario that: PTX transmits a number like "100", PRX receives this data "100" and plus "1". Now data is "101" at the PRX side. And PRX transmits "101" to PTX as a response. Finally, PTX receives the data "101". The example that I try to do is a basic ping-pong mechanism.

  • Is there anyone did an example like this?
  • How to change transceiver mode in order to provide this types of mechanism dynamically?

--Edit--

I realize my question is a bit general. If I tell my issue as more practically, I can not change nrf52832 ESB mode in the loop. Either PRX or PTX could be received and transmitted data at the same time in my desired example. I guess nrf_esb_start_rx, nrf_esb_stop_rx,nrf_esb_start_tx,nrf_esb_init functions provide this functionality. But, when i use nrf_esb_start_rx, nrf_esb_stop_rxfunctions in while(true){} loop, the program is totally collapse (nrf52832 resets repeatedly). How can I solve this problem?

Thank you!

  • The initial case you describe seems OK to me (unless I got something wrong):

    1. PTX sends a number (100) to the PRX
    2. PRX adds 1 to the received number and sends that number (101) in the ACK with payload.

    To implement this the PRX should use selective ack and use nrf_esb_write_payload() to write the data that goes in the ack package.

    Regarding the updated part of your question. Why do you have to switch mode, if you only need to send a ack with payload? Can you be more specific about what you do in this case, and what happens before the chip is reset? It could be due to an APP_ERROR_CHECK that fails, and if so, it can easily be debugged (described in An introduction to error handling in nRF5 projects).

Related