ESB payloads are wrong when using length 252 packets

I am using ESB with dynamic payload lengths. When I use length 252, I am sending the alphabet repeating, and I can see that the data cuts off around position 30 and repeats itself from the start in my payloads on receive. However, when I use size 32 packets, which is the default max size that is supposed to be able to be configured up to 252, everything is fine. What could be the reason that my received payloads are erroneous when I use larger packets? I am sending between a NRF52832 and a NRF52840.

Parents Reply Children
  • How does your payload look like ?

    Example payload:

    static struct esb_payload tx_payload = ESB_CREATE_PAYLOAD(0,
    	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17);

  • static nrf_esb_payload_t tx_payload = { .pipe = 0, .noack = false, };

    Then I am setting length and writing to data with memcpy manually before doing nrf_esb_write_payload() later on. I am writing my payloads in my ESB event handler. Note that I confirmed that this works perfectly as long as I use length and data of size 32. If I uses 252, I encounter weird behavior. Would you like me to provide an example say length 50 payload, what I'm sending and what I receive?

    Edit: I created an example for you.

    From this payload (off the static definition above, note that DATA is 0x01)

    tx_payload.data[0] = DATA;
    tx_payload.length = 51;
    uint8_t arr[50] = { '0', '0', '-', '0', '1', '-', '0', '2', '-', '0', '3', '-', '0', '4', '-', '0', '5', '-', '0', '6', '-', '0', '7', '-', '0', '8', '-', '0', '9', '-', '0', 'a', '-', '0', 'b', '-', '0', 'c', '-', '0', 'd', '-', '0', 'e', '-', '0', 'd', '-' };
    memcpy(&tx_payload.data[1], arr, 50);
    result_value = nrf_esb_write_payload(&tx_payload);
    

    I receive:

    Note that on the transmitter I have the latest NRF52 SDK and on the receiver I am using the Nordic Connect SDK. I checked their libraries, and they function equivalently, so it should not be a problem.

    It appears actually that data becomes erroneous and somewhat repeats with null bytes in-between exactly from byte 32. But I am using two NRF52 devices, so they definitely should support length 252 payloads.

  • Note that I just tested a sample application (using the same data as my other reply) between a NRF52840 PDK and a NRF52840 DK with the Nordic Connect SDK, and the data transfers fine. So the problem is either between a NRF52832 and a NRF52840, or between the NRF52 SDK and the Nordic Connect SDK.

  • (sorry the interface won't let me reply to or edit my own reply so I am replying to you again), I just tested between the 52832 SoC on my device and the nrf52840, which were the conditions of my first test. This time both NRF Connect SDK. The data sends fine. So the problem is between NRF52 SDK and NRF Connect SDK. Why? Their libraries are exactly the same for ESB. I am thoroughly stumped.

  • The problem was that I was defining NRF_ESB_MAX_PAYLOAD_LENGTH in a file included earlier, instead of changing it in nrf_esb.h directly in the NRF52 SDK. I have no idea why. It has include guards around it. Technically this is solved, but I will update this if I figure out why the include guard doesn't work.

Related