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

NRF52 DK - Dynamic payload(DPL) and static payload.

I have an NRF24LE1 transmitter using ESB. It is sending a static payload of 10 bytes every sec. The other configurations on the transmitter are: RF channel:2, CRC: 1 byte, DataRate: 1MBPS.

I am trying to understand the given example code for esb_prx for NRF52-DK in NRF5 SDK 11.0. which I am using as Receiver.

It seem dynamic payload length - DPL is used as a default configuration. Can I use dynamic payload to talk to my current transmitter which has static payload ? What is dynamic payload mean, does it mean I can send any number of bytes to the Receiver? If so, payload_length field of nrf_esb_config_t in Receiver become irrelevant in DPL mode.

On a side question about esb_ptx in NRF52-DK:

#define NRF_ESB_CREATE_PAYLOAD(_pipe, ...)                                                  \
        {.pipe = _pipe, .length = NUM_VA_ARGS(__VA_ARGS__), .data = {__VA_ARGS__}};         \
        STATIC_ASSERT(NUM_VA_ARGS(__VA_ARGS__) > 0 && NUM_VA_ARGS(__VA_ARGS__) <= 63)

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

What will be the pipe number, length and data values using NRF_ESB_CREATE_PAYLOAD macro ? But nrf_esb_payload_t is defined as follows:

typedef struct
{
    uint8_t length;                             /**< Length of the packet. Should be equal or less than      
                                                        NRF_ESB_MAX_PAYLOAD_LENGTH. */
    uint8_t pipe;                                   /**< Pipe used for this payload. */
    int8_t  rssi;                                   /**< RSSI for received packet. */
    uint8_t noack;                                  /**< Flag indicating that this packet will not be 
                                                          acknowledged. */
    uint8_t pid;                                    /**< PID assigned during communication. */
    uint8_t data[NRF_ESB_MAX_PAYLOAD_LENGTH];  /**< The payload data. */
} nrf_esb_payload_t;

Does the macro fill all the fields of this structure, if so, what will be the values of each field in this example?

Thanks,

Parents
  • Hi,

    Dynamic payload means that payload length is configurable for every packet sent.

    In non-DPL mode every payload has to be of pre-determined length.

    I don't believe DPL <-> fixed payload length communication is possible.

    DPL is configured in the nrf_esb_config_t->protocol field, and can take the following values:

    NRF_ESB_PROTOCOL_ESB,      /*< Enhanced ShockBurst with fixed payload length.                                            */
    NRF_ESB_PROTOCOL_ESB_DPL   /*< Enhanced ShockBurst with dynamic payload length.      
    

    What you want to do is configure ESB to run in fixed packet length mode. I think this configuration should be suitable for your scenario:

    nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
    nrf_esb_config.payload_length           = 10;
    nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB; //No DPL
    nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_1MBPS;
    nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
    nrf_esb_config.crc                      = NRF_ESB_CRC_8BIT // 1 byte CRC
    nrf_esb_config.event_handler            = nrf_esb_event_handler;
    nrf_esb_config.selective_auto_ack       = false;
    

    When using DPL the payload_length field in nrf_esb_config_t is ignored, and the length specified in the payload struct is used instead.

Reply
  • Hi,

    Dynamic payload means that payload length is configurable for every packet sent.

    In non-DPL mode every payload has to be of pre-determined length.

    I don't believe DPL <-> fixed payload length communication is possible.

    DPL is configured in the nrf_esb_config_t->protocol field, and can take the following values:

    NRF_ESB_PROTOCOL_ESB,      /*< Enhanced ShockBurst with fixed payload length.                                            */
    NRF_ESB_PROTOCOL_ESB_DPL   /*< Enhanced ShockBurst with dynamic payload length.      
    

    What you want to do is configure ESB to run in fixed packet length mode. I think this configuration should be suitable for your scenario:

    nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
    nrf_esb_config.payload_length           = 10;
    nrf_esb_config.protocol                 = NRF_ESB_PROTOCOL_ESB; //No DPL
    nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_1MBPS;
    nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
    nrf_esb_config.crc                      = NRF_ESB_CRC_8BIT // 1 byte CRC
    nrf_esb_config.event_handler            = nrf_esb_event_handler;
    nrf_esb_config.selective_auto_ack       = false;
    

    When using DPL the payload_length field in nrf_esb_config_t is ignored, and the length specified in the payload struct is used instead.

Children
Related