RAK3172 how to correct detect free air to send

I’m using RAK3172 for my project (in C for STM32WLE5) and I need to check when the module can send a packet. I use IRQ_PREAMBLE_DETECTED in the interrupt to check for free airtime. Data size 10–128 bytes.

Is the correct way to check if data can be sent?
I also have a queue in my device where all the commands to be sent are added with a pause between them - 500 ms.
How to check when the device will be able to send the next message on the air?


Hi @Yevhen ,

We haven’t explored much detection when air is free for transmission. I see many interest on this in the past but didn’t push thru much.

I am not sure if you already saw this but these two threads in TTN forum might provide you useful insights.

yes, I have read this forum. But I didn’t find any normal example with CAD. For now I get always IRQ_CAD_DETECTED after enabling it. I think it is wrong because this interrupt might be set when the signal is detected.

this is how i activate the CAD mode:

SUBGRF_SetCadParams(LORA_CAD_04_SYMBOL,10 + 13,10, LORA_CAD_RX,0);
fsm->subState = SSTATE_CAD;
                       IRQ_CAD_CLEAR | IRQ_CAD_DETECTED,
                      IRQ_RADIO_NONE );
SUBGRF_SetSwitch(powerType, RFSWITCH_RX);

and after this, I get IRQ_CAD_DETECTED from CAD

what wrong?

Hi @carlrowan
Can you explain how I can tune settings for CAD?
for now, I sometimes have false IRQ from CAD. I use these settings with spreadfactor 10:
symbol = LORA_CAD_04_SYMBOL
Detect Peak = 24
Detect Min = 10
Cad Exit Mode = LORA_CAD_RX
Cad Timeout = 10000

how it work? what does it means “Cad timeout”? Is it timeout for all my packages or only for finding preamble?

I tried to change timeout - but with timeout <10000 - the node doesn’t receive anything, but I have CAD_DETECT.
If I set timeout >10000 - the node receives correctly, but I have a timeout for sending - from CAD_DETECT to CAD_CLEAR

In the datasheet from STM for stm32wle - these parameters need to be tuned, but how can I tune it correctly?

with regards