The LoRa Developer Forum is now in read-only mode and new content will not be added. If you require technical support related to LoRa, please contact our experts here. For sales enquiries, please contact us here.

FORUM

SX126x and RxDutyCycle

Hi,

The RxDutyCycle feature of the SX126x is defined in the AN1200.36 application note.

This applcation note shows an extract of a LoRa Power Consumption Calculatore. I have not been able to find this calculator, which should be an Excel spreadsheet by the look of it.

Can you tell me where to find this ?

Also, could you give some example of Sleep duration / RX duration that are valid to use with the SetRxDutyCycle feature ?

I have setup my own Excel spreadsheet to compute the maximal sleep period (depending on the preamble length, the spreading factor and the bandwidth) and the corresponding minimal RxPeriod.

When I replace my Rx(0) function by SetRxDutyCycle() with the output of my excel sheet, I no longer have a 100% packet transmission rate (with both devices next to each other), so I assume something is wrong with my calculation.

Here is what I do, feel free to tell me what’s wrong :
With SF7 and a bandwidth of 125kHz, a symbol duration is 1024µS.

I used the following two formulas as base :
image

Tpreamble >= sleepPeriod + 8 symbols in LoRa

With a preamble length of 8 symbols, I calculate the following :

1024 * (8 + 4.25) = 12544µS for the preamble duration

Max sleep period = T preamble - 8 symbols = 4352µS. As the register configuration requires a multiple of 15.625µS, I use 4343.75µS (giving a register value of 278).

Min Rx Period = (T preamble + T header - T sleepPeriod) / 2 = ( 12544 + 8192 - 4343.75 ) / 2 = 8192. As the register requires a multiple of 15.625, I use 8203.125µS (giving 525 as register value).

Could you help me figure out what’s wrong ?

Regards.

Can you please share how the Tx side is managed?

Tx side is managed by doing executing the following 3 lines every time a software timer expires (in normal, non-interrupt state), every 2 seconds:

    Radio.SetChannel(RF_FREQUENCY);
    HAL_Delay(Radio.GetWakeupTime() + TCXO_WORKAROUND_TIME_MARGIN);
    Radio.Send(buffer, bufferSize);

At the start of the system, Tx is configured with the following parameters:

#define RF_FREQUENCY                                869500000 /* Hz */

#define TX_OUTPUT_POWER                             14        /* dBm */

#define LORA_BANDWIDTH                              0         /* [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] */
#define LORA_SPREADING_FACTOR                       7         /* [SF7..SF12] */
#define LORA_CODINGRATE                             1         /* [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] */
#define LORA_PREAMBLE_LENGTH                        8         /* Same for Tx and Rx */
#define LORA_SYMBOL_TIMEOUT                         5         /* Symbols */
#define LORA_FIX_LENGTH_PAYLOAD_ON                  false
#define LORA_IQ_INVERSION_ON                        false

#define RX_TIMEOUT_VALUE                            10000
#define TX_TIMEOUT_VALUE                            3000
#define BUFFER_SIZE                                 64  /* Define the payload size here */

#define TCXO_WORKAROUND_TIME_MARGIN                 50  /* 50ms margin */

Radio.SetTxConfig(MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
                LORA_SPREADING_FACTOR, LORA_CODINGRATE,
                LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
                true, 0, 0, LORA_IQ_INVERSION_ON, TX_TIMEOUT_VALUE);

On the Rx side, if I do only Radio.Rx(), I get all messages.

If I do Radio.SetDutyCycle with the values defined from my calculation, I see a lot of packet losses (I do not have RxDone every 2s).

Can you please share the parameters you use when calling SetRxDutyCycle(uint32_t rxTime, uint32_t sleepTime)?

I am trying to use the max sleep period I computed earlier and the minimum Rx Period (see first post) :

/** Rx duration for Rx duty cycle listen mode (in us) */
#define RX_DUTY_CYCLE_RX_DURATION     (8203.125f)
/** Sleep duration for Rx duty cycle listen mode (in us) */
#define RX_DUTY_CYCLE_SLEEP_DURATION  (4343.75f)

/** Rx duration for Rx duty cycle listen mode (in units of 15.625us) */
#define RX_DUTY_CYCLE_RX_DURATION_REGISTER    ((uint32_t)(RX_DUTY_CYCLE_RX_DURATION / 15.625f))
/** Sleep duration for Rx duty cycle listen mode (in units of 15.625us) */
#define RX_DUTY_CYCLE_SLEEP_DURATION_REGISTER   ((uint32_t)(RX_DUTY_CYCLE_SLEEP_DURATION / 15.625f))

Radio.SetRxDutyCycle(RX_DUTY_CYCLE_RX_DURATION_REGISTER, RX_DUTY_CYCLE_SLEEP_DURATION_REGISTER);