STM32WL (SX1262): how to receive packet of unknown length

Hi everyone!

I’m trying to send and receive packets from an STM32WL (SX1262 inside) to existing S2-LP based products and the RF settings (GFSK @ 50 kbps, LEN field, 16-bit CRC, IBM data whitening) can not be changed. Unfortunately the data whitening is incompatible: the SX1262 uses CCITT data whitening. The work around is to send a packet of known fixed length and calculate the 16 bit CRC and data whitening in FW.

To receive a packet, I set the fixed length to the maximum expected (64 bytes). When I get the SYNC word interrupt, I wait for a short delay (160 us) and read the first byte in the RX buffer. This gives me the actual length of the packet (for example 4 bytes).

Is there a way to changed the fixed length “on the fly” so that RX is terminated after 4 bytes are received? Or is the only way to wait for 2560 us and stop RX manually? How do I do this?

Any hints / tips is much appreciated!

Thanks in advance,