Skip to main content
Associate
May 15, 2026
Question

PREAMBLE PQI check not working on STM32WL33xx

  • May 15, 2026
  • 3 replies
  • 141 views

Hi, I'm searching for the best  Rx sniff mode as suggested in AN6362: I'm able to use carrier sense (RSSI_THR, CS_F interrupt) and SQI (SQI_THR, SYNC_VALID_F interrupt) but PQI never works.

The MCU is in WFI state, sequencer not used.

I have changed the value of  PQI_THR but PQI_INFO is always zero and the PREAMBLE_VALID_F interrupt is always received a few microseconds after CS_F interrupt.

Thank you in advance!

 

3 replies

Technical Moderator
May 15, 2026

Hi syn,

welcome to the ST community!


I am pleased to read that you are using application note AN6362.

To assist, provide the radio settings and packet settings you are using (in particular the modulation type and the preamble length and sequence), to double-check if the configuration is correct or not.

Following is the PQI_THR description from the Reference Manual (RM0511). 

PQI_THR.png

 

BR,
Filippo

synAuthor
Associate
May 18, 2026

Hi Filippo,
thanks for your fast answer.

These are my settings:
BaseFreq = 865MHz
Modulation = 2GFKS1
Rate = 50Kbit/s
FreqDev = 25kHz
PassBand = 100KHz
DsssExp = 0
outputPower = 10
driveMode = DVR_TX_HP (14dBm)
preambleLength = 32 pairs
postambleLength = 0
syncLength = 31
varLengthEnable = true
preambleSequence = 0101
crcMode = 8bit
coding = none
dataWhitening = enable
lengthWidth = 2
syncPresent = enable
RSSI_THR = 0x90
PQI_THR = 0xf (using other values gives the same results)
AS_CS_BLANKING = 0x1

Timestamps are done saving ABSOLUTE_TIME (clocked at 31250 Hz) value in ram variables when interrupts are received:
CSIrq = 7946118
preambleValid = 7946123 (is about 10 microseconds after CSIrq)
PQI_INFO_val = 0 (on preamble valid interrupt)
SyncValid = 7947194
radioSyncCaptureTime = 7947192
rxOk = 7948561


Thanks and Best Regards

Technical Moderator
May 18, 2026

Hi syn,

your configuration looks good to me, except for the PQI_THR value which is too high in the light of the preamble length.

I suggest you these experiments:
- send a continuous wave and check if the PREAMBLE_VALID_F rises (if so, it means the PQI_THR = 0)
- set a PQI_THR = 1 and increase the preamble length. After receiving the interrupt for the PREAMBLE valid, read as long as the PQI_INFO, the PQI_THR as well, to double-check that the value is the one you set and not zero.

Double-check that the preamble sequence is one of the first two: 0101 or 1010. 

The fact that you are getting the preamble IRQ just after the carrier sense IRQ, it smells like the PQI_THR is zero.

BR,
Filippo

Technical Moderator
May 19, 2026

Hi syn,

The PQI_INFO value increments by 1 each time a bit inversion is detected and decrements by 4 each time a bit repetition occurs. It is possible that the SYNC_WORD contains more bit repetitions, which affects PQI_INFO and causes it to decrease to zero. Before detecting the full SYNC_WORD, the demodulator does not know whether it is still receiving the preamble, the first sync word bits, or any other interferer.

Therefore, I suggest using a long preamble (greater than 16 bytes) and setting PQI_THR to 8 (that is, 32 bit inversions). Read PQI_INFO as soon as PREAMBLE_VALID_F rises. Additionally, consider checking again the PQI_INFO value after the RX_OK interrupt, after successfully receiving the packet.

 



BR,
Filippo

synAuthor
Associate
May 20, 2026

Hi Filippo;

I have the S2-LP datasheet that explains how PQI_INFO works.

PREAMBLE_VALID_F rises immediately after CS_F so there is no reason in changing any of the bits that are transmitted later.

My conclusion is that PQI_THR is always zero for an hardware bug.

Thank you very much for you help.

Best Regards

Technical Moderator
May 20, 2026

Hi syn,

I have tested using the BasicGeneric_RX example (attached is the main modified) and the PQI_INFO is working.


Try sending packets with long preamble (64 bits) and short preamble (16 bits) you will see that in the first case the IRQ rises and the packets are received, in the second case the IRQ does not rise, and so packets are not received.

BR,
Filippo

synAuthor
Associate
May 21, 2026

Hi Filippo,

comparing your code and ours solved the problem!

When AFC_INIT_MODE = 0 it works as expected but with AFC_INIT_MODE = 1  PQI_INFO is always zero and the PREAMBLE_VALID_F rises immediately after CS_F.

The datasheet suggests AFC_INIT_MODE = 1 for short preambles, which value is the best for a 32 pairs one?

Thanks again!!!

Best Regards