unlimited packet length example for sx1272 or sx1276
user button on MCU board toggles between receive operation on radio and transmit. (Latching PTT). Look at serial terminal at 9600 to see operation. User button is pressed once to start transmit, and again to end transmit: it doesnt need to be held down during TX.
The example payload is a continuously incrementing byte, with zero at start of packet.
End of packet is detected by four consecutive bytes which dont increment with expected value: background noise, this indicates transmitter has finished. This serves only as an example, because some other method would likely be needed in an application, such as unique data indicating end, or the length sent at begin of packet.
FifoThreshold is used for transmit flow control. With fifo is below threshold, bytes are send to the radio's fifo. While fifo is above threshold, nothing is sent until the fifo threshold pin returns low. AKA
On receive, the packet reception is initialized by
SyncAddress pin going high, indicating start of packet. Bytes are read from FIFO when the
FifoEmpty pin is low.
The packet buffer (AKA FIFO) in sx127x is only 64 bytes, meaning the maximum time between
FifoEmpty would be 512 bit periods. This needs to be considered: the MCU latency of servicing
FifoEmpty pins during packet, otherwise empty byte would be sent on transmit or byte missed on receiver.
The rxTrigger is used on preamble to enable start-of-frame detection, aka sync word. When end of packet is detected, the receiver is restarted. In this case, restarted with PLL when AFC is used, or without PLL when AFC not enabled.
The serial terminal will show when packet reception starts, and when there are incorrect bytes received over the air. This will always happen and end of packet for this example.