ESB. It is not possible to change the load of ACK on PRX.

PTX transmits data to PRX every second. The PRX should attach the payload to each ACK using nrf_esb_write_payload. In debugging on PRX, I see that the data is different every time. But the PTX receives data that was uploaded to the ASK for the first time.
That is, it turns out that after the first use of nrf_esb_write_payload on the PRX, it is impossible to change this data during subsequent transmissions.
If I do nrf_esb_flush_tx() on the PRX, it sends a normal ASK without load. As soon as I use nrf_esb_write_payload, the load that was at the very first call to nrf_esb_write_payload will be attached to the ASK.

  • I use nrf5_sdk_17.1.0.
    After the transfer, PTX power off and reinitializes after a second, but I don't think that's the problem.

  • Hi,

     

    The ACK payload is sent back when the PRX receives a payload. This means that the ACK payload must be pre-loaded on the PRX side, if not, you will have to do something like this:

    1. PTX sends "prepare ack payload"

    2. PRX receives payload, and uploads using nrf_esb_write_payload

    3. PTX sends "dummy" payload

    4. PRX sends ACK payload back to PTX.

     

    Kind regards,

    Håkon

  • Thanks for the quick reply.
    I have no idea when to call nrf_esb_flush_rx() and nrf_esb_flush_tx() on the PRX side and on the PTX side.
    I completely removed the call to nrf_esb_flush_rx() and nrf_esb_flush_tx() on the PRX side and everything worked!
    But this is probably not correct.

  • Everything worked until I started disabling the transmitter again with the nrf_esb_disable() function. It looked something like this (pseudo-code):
    while(true){
    nrf_esb_init()
    nrf_esb_write_payload()
    nrf_esb_disable()
    delay(1000)
    }
    The transmitter responded only once. This was due to packet identification: "Any packet that is transmitted from a PTX to a PRX is uniquely identified by a two-bit packet ID field (PID) in the packet header along with the packet's Cyclic Redundancy Check (CRC) field. This packet ID is used to distinguish a new packet from the previous packet if it has the same payload."
    Since I completely disconnected and reinitialized the ESB, the PID was the same. The message was also the same, and so was the CRC. So, probably, PRX thought that it was the same packet from PTX.
    When I switched to nrf_esb_suspend and nrf_esb_start_tx, everything worked:
    while(true){
    nrf_esb_start_tx ()
    nrf_esb_write_payload()
    nrf_esb_suspend()
    delay(1000)
    }

  • Hi,

     

    taras789 said:
    Everything worked until I started disabling the transmitter again with the nrf_esb_disable() function. It looked something like this (pseudo-code):
    while(true){
    nrf_esb_init()
    nrf_esb_write_payload()
    nrf_esb_disable()
    delay(1000)
    }
    The transmitter responded only once. This was due to packet identification: "Any packet that is transmitted from a PTX to a PRX is uniquely identified by a two-bit packet ID field (PID) in the packet header along with the packet's Cyclic Redundancy Check (CRC) field. This packet ID is used to distinguish a new packet from the previous packet if it has the same payload."
    Since I completely disconnected and reinitialized the ESB, the PID was the same. The message was also the same, and so was the CRC. So, probably, PRX thought that it was the same packet from PTX.

    Your conclusion here is correct.

    If you always fully disable ESB, and do not change the payload in-between iterations, the payload will be exactly equal, and the receiver will look at this as a retransmit.

    Suspending ESB, as you've done, is then the correct approach.

     

    Kind regards,

    Håkon

Related