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

Dynamic switching of prefixes not working with ESB

I am using the '840 to construct a small network using the ESB stack.  In this design, a master (dongle) transmits to each slave and receives an ACK w/payload response.  The ACK payload contains all data coming from the slave (<100 bytes).  The master operates in PTX mode while the slaves are always in PRX mode.  This design uses 8 1 MS time-slots in a 120 Hz frame.  Each slave is configured with a different prefix before operation to provide for individual addressing. The master pings each slave using the assigned prefix over pipe 0, dynamically changing the prefix for each slave as it proceeds.  This design works with a single slave (no prefix changes) but stops working when prefix swapping is enabled.  I get a NRF_ESB_EVENT_TX_SUCCESS event on the master each time it sends the data query but the slave never responds (the ESB event handler never sees a NRF_ESB_EVENT_RX_RECEIVED).  Are there any constraints to when/how the prefix is changed in the '840 radio that might explain this behavior?

Parents
  • Hi,

    I am not quite sure, but make sure that the payload changes (e.g. add a counter in the payloads) this to ensure that the packet is not treated as a retransmit by the PRX (in which case it will ack to the PTX, but not inform the application on the PRX (since it is considered an retransmit)).

    Have you tried to disable, reconfigure prefix and enable again, to see if that make any difference?

    Best regards,
    Kenneth

  • There are no re-transmission since it is set to 0 in the nrf_esb_init() configuration.  I've tried by bracketing the prefix change with nrf_esb_suspent() and nrf_tx_start() but no change.  I've also tried to use nrf_esb_disable() before the prefix change with nrf_esb_init() following it but does not work.  It seems that whenever I change the prefix, the pipe shuts down. Any suggestions?

  • Very odd. Have you tried to debug the RADIO peripheral before and after changing the prefix?

    Keil: When debug click Peripherals->Sysem Viewer->Radio, then you can see all radio registers, and which change when single stepping code.

    SES: When debug click on the Registers window->Groups and select Radio.  Example:

    Best regards,
    Kenneth

Reply Children
  • Looks like I am getting stuck when the PTX sends a payload using ACK w/payload and doesn't receive and answer.  This leaves the radio in the NRF_ESB_STATE_PTX_RX_ACK state (the prefix cannot be changed unless in IDLE).  Ideally I would remove the packet from the TX FIFO and clear the NRF_STATE_PTX_RX_ACK state from the stack.  I tried disabling, re-initialize and update prefix but it does not seem to work.  Any suggestions?

  • That might be it. If the PTX is transmitting a payload using nrf_esb_write_payload(e.g. retransmit_count = 0..n or tx_payload.noack = true), is there any reason why you can't wait for the nrf_esb_event_handler() return NRF_ESB_EVENT_TX_SUCCESS, NRF_ESB_EVENT_RX_RECEIVED or NRF_ESB_EVENT_TX_FAILED?

    Then the radio should be in idle state (e.g. check nrf_esb_is_idle()) and you call nrf_esb_update_prefix()?

Related