Packet parameters

Structure used in packets

Packets are structured in WaspSX1272.h using a defined structure called pack. This structure has many fields to be filled by the user or the application:

dst Destination node address: this parameter is indicated as an input in the function used by the user.

src Source node address: this parameter is filled by the application with the module\'s address (previously set by the user).

packnum Packet number: this parameter indicates the packet number and is filled by the application. It is a byte field, so it starts in 0 and reaches 255 before restarting. If the packet is trying to be retransmitted, the packet number is not incremented.

length Packet length: this parameter indicates the total packet length and is filled by the application.

data[MAX_PAYLOAD] Data to send in the packet: It is used to store the data to send to other nodes. All the data to send must be stored in this field. Its maximum size is defined by MAX_PAYLOAD, a constant defined in the library.

retry Retry counter: this parameter is filled by the application. It is usually equal to 0. Only when we use the retries feature, this value is incremented from 0 to the maximum number of retries stored in the global variable _maxRetries which value is 3 by default. If the packet is sent successfully, or if the maximum number of retries is reached without success, the retry counter is set to 0.







(1 Byte)

(1 Byte)

(1 Byte)

(1 Byte)

(Variable Bytes)

(1 Byte)

Figure: Packet structure

Maximum payload

The maximum data payload is defined as:


250 Bytes

Figure: Maximum payload size

Due to the limit on maximum payloads it could happen that the packet has to be truncated to the maximum possible length.

The current available payload when operating in LoRa mode can be retrieved in real time.

Example of use:

    sx1272.getPayloadLength(); // Get Maximum Payload Bytes

Related variables:

sx1272._payloadlength → stores the maximum payload is available at the moment

Last updated