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

Enhanced ShockBurst (ESB) Payload handling issue

Hi.

I'm using nrf52832 with SDK-17, and the ESB example       (esb_tx      and      esb_rx)

I'm not much experience in nrf development recently I have a project related to ESB to transmit and receiver data, here is my problem and some questions.

The payload of ESb  transmitter and receiver is buffer is shared as when the after Ack occur ?

Like I make a logic to send different intergers on button press so I use a payload which is initialized at top

//static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00);


static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 1, 2,3,4,5);

static nrf_esb_payload_t        tx_payload;
  

i try to send a specific data on button press I make a logic for button using button handler when ever I send the data using the function below the data is send nicely

   if (nrf_esb_write_payload(&tx_payload) == NRF_SUCCESS)
        {
      static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(7,8);
          
     tx_payload.data[1];  ///the index 1
 NRF_LOG_INFO("Transmitting packet %d", tx_payload.data[1]);
        }
          else
        {         
         NRF_LOG_INFO("Sending packet failed");
        }

The problem on the Receiver side !!

 how can I get only the exact number on the receiver side in the buffer the whole buffer I don't wanna share? 

Reciever side to get the payload.. I get the payload but not the way i want please help me about this     

 if (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
            {

    

         
     // NRF_LOG_INFO("Receiving pa
                  if(rx_payload.data[1] == 7)
                  {
                     NRF_LOG_INFO("Receiving packet 6");
                     NRF_LOG_INFO("Receiving packet: %d", rx_payload.data[0]);
             
                  }
 

on the Reciever side, I don't want the buffer index to be the same as cause it does not make my logic right...

i hope the problem is justified well if someone have question asked me about it ,

  • thanks, buddy I got it,

    I make a 4 payload with a different name and it solves

    static nrf_esb_payload_t        tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 0,3,);
    
    static nrf_esb_payload_t        tx_payload;
    
    static nrf_esb_payload_t        tx_payload1 = NRF_ESB_CREATE_PAYLOAD(0,0,4,);
    
    static nrf_esb_payload_t        tx_payload1;
    
    static nrf_esb_payload_t        tx_payload2 = NRF_ESB_CREATE_PAYLOAD(0, 0,5);
    
    static nrf_esb_payload_t        tx_payload2;
    
    static nrf_esb_payload_t        tx_payload3 = NRF_ESB_CREATE_PAYLOAD(0, 0,6);
    
    static nrf_esb_payload_t        tx_payload3;
    
    static nrf_esb_payload_t        tx_payload4 = NRF_ESB_CREATE_PAYLOAD(0, 0,7);
    
    static nrf_esb_payload_t        tx_payload4;
    the problem

  • Hi

    It is good to hear you found a solution Slight smile

    I will consider the case closed then, unless you have more questions?

    Best regards
    Torbjørn

Related