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

ESB ACK payloads

I am trying to set up ack in my PTX so that when my PRX is off or out of range I get the case TX_FAILED event and when it is on and receiving data my PTX will get the case TX_SUCCESS.

So far PTX is either always SUCCESS when I have tx_payload.noack =true; and I always get FAILED when this is set to false. I have verified that the PRX is receiving the data, and is set up to send back a few bytes in a payload along with its ack. I am getting both RX_RECEIVE and TX_SUCCESS from the PRX.

Edit: Also I would like to add that my PTX never triggers the RX_RECEIVE event, so I am not sure how I can read out the ack payload from the PRX that I created with nrf_esb_write_payload()

Do you have any tips for what I can be doing wrong?

Included is the main.c for the ptx and prx both running on 2 nrf52840 DK boards.

prx.zip

ptx.zip

Best regards, 

jake

  • Do you see the same behavior if you comment out the "workaround to enable 250k data rate on nrf52840" on both ends of the link?

  • yes, it made no difference I think that maybe it has to do with nrf_esb_config.selective_auto_ack setting. If this is set true, then I do not need to use the .noack setting correct? And will my transmitter have RX_RECEIVED events?

    Or do I have to do something like an idle state or __WFE() to be able to get the RX_RECEIVE and read the RX FIFO on the PTX?

    My third option is to maybe do another esb_init function that sets the PTX into PRX mode after the first send so it can accept the ack packet from my PRX and then inside of the RX_RECEIVE case I switch back to PTX mode once the packet is read.

    I will try option 3 later tonight and see how it goes,

  • If selective_auto_ack is false then an ACK is always expected. Otherwise, setting noack in the packet will cause the ACK to be skipped and TX_SUCCESS will be generated immediately.

    The PTX only puts its radio into receive mode to wait for the ACK for a short amount of time (see RX_WAIT_FOR_ACK_TIMEOUT_US_* at the top of nrf_esb.c). If you told nrf_esb that you are using 1mbps but manage to force the radio into a lower bitrate then there's a good chance that the PTX will stop listening for the ACK before the PRX has a chance to finish sending it. This would explain your TX_FAILED events.

  • I understand now a bit better, I set the radio back to 1mbit for now and will try changing the auto ack false and leaving out the noack fields. 

    Update: I setup selective_auto_ack = false and removed the code lines for .noack,  I get the rx_receive on the PTX now and the 0x42 is received. I had a big misunderstanding of the selective_auto_ack =)

    Many thanks,

    jake

Related