Skip to content
Get started

SX1231 Packet Interface

The sx1231 Packet Interface platform sends and receives packets with an SX1231 or RFM69 radio configured with the SX1231 component. Each packet is sent as one radio packet, so the radio itself marks where a packet starts and ends, and checks it with its CRC if crc_enable is set.

The radio must be in packet mode (packet_mode: true, the default) and send packets of varying length, so its payload_length must be 0, the default. It must also have a sync_value set, as this is how the interface tells that a packet is arriving, so that it does not send over it. The radio must listen again after sending (rx_start: true, the default) when the link has a reliability or session layer or the rolling code, as these need packets back from the peer.

The radio sends at most 64 bytes in a packet, so max_packet_size is 64 or less. Use a fragmentation layer to send larger packets.

Received packets carry the radio’s RSSI, which the layers above pass on. The radio does not measure the SNR, so it is not known (NAN).

A radio channel is shared by every device in range, so an addressing layer is usually needed: it drops packets meant for other devices, and lets the reliability and session layers work with one device among several.

Sending waits until the radio has transmitted the packet, and the radio cannot receive while it sends. A packet is not sent while the radio is receiving one: the send fails, and the component sending it is told. A reliability layer sends it again shortly, so use one with components such as packet_transport that do not retry, or the packet is lost.

With a reliability layer, the timeout must allow for the largest packet that any device on the channel can send, and an acknowledgement. Without a timeout, the link works one out from the radio’s settings and ack_delay.

# Example configuration entry
sx1231:
# ... radio pins and settings
frequency: 868MHz
modulation: FSK
sync_value: [0x2D, 0xD4]
packet_interface:
- platform: sx1231
  • sx1231_id (Optional, ID): The ID of the SX1231 radio to use. Required only if more than one is configured.
  • max_packet_size (Optional, int): The largest packet, in bytes, that can be sent or received. Range is 16 to 64. Defaults to 64.
  • id (Optional, ID): Manually specify the ID used for code generation.