2025-03-08 5:44 AM
Hi,
I am working on a LoRa point-to-point communication project using the STM32WLE5CCU6 chipset, referring to the SubGHz_Phy_PingPong example code. The communication works fine with SF7, but I’m encountering issues when transmitting on SF12 with a bandwidth of 125 kHz. Rx errors occur at the receiver, and only one packet is received in 5 tries.The distance between the transmitter and receiver is less than 3 meters."
Configured LoRa parameters are given below.
/* MODEM type: one shall be 1 the other shall be 0 */
#define USE_MODEM_LORA 1
#define USE_MODEM_FSK 0
#define RF_FREQUENCY 866000000 /* Hz */
#ifndef TX_OUTPUT_POWER /* please, to change this value, redefine it in USER CODE SECTION */
#define TX_OUTPUT_POWER 14 /* dBm */
#endif /* TX_OUTPUT_POWER */
#if (( USE_MODEM_LORA == 1 ) && ( USE_MODEM_FSK == 0 ))
#define LORA_BANDWIDTH 0 /* [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] */
#define LORA_SPREADING_FACTOR 12 /* [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
I would appreciate any guidance or suggestions to help resolve the issue with SF12 at 125 kHz.
Thank you in advance for your support.
2025-03-08 5:51 AM - edited 2025-03-08 5:51 AM
Hello @Akhil_Joseph @and welcome to the ST Community.
First, do you have the same issue with other SF and BW. Also, are you sure about the validity of your design.
Could you please give more details.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-03-08 6:32 AM - edited 2025-03-08 8:03 AM
Look at how long it takes too transmit the data. Check what kind of timeout and alignment you have at reception. Other LoRa implementations don't stop the timeout once data starts arriving
2025-03-11 12:21 AM
Hi @STTwo-32
I have conducted a test on all SF and bandwidth settings. The function used to configure TX and RX is outlined below:
Test: Send data from one module to another. If received successfully, the data is sent back (echo)
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);
Radio.SetRxConfig(MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
0, true, 0, 0, LORA_IQ_INVERSION_ON, true);
SF : BW | Result |
12 : 125 | Rx Error |
12 : 250 | Successful tx rx |
12 : 500 | Rx Error |
11 : 125 | Successful tx rx |
11 : 250 | Rx Error |
11 : 500 | Successful tx rx |
10 : 125 | Rx Error |
10 : 250 to 7 : 500 | Successful tx rx |
Then, I used the RadioSetTxGenericConfig and RadioSetRxGenericConfig functions for configuration. The code and test results are given below
TxConfigGeneric_t TxConfigGeneric;
TxConfigGeneric.lora.Bandwidth = Bandwidths[RamFlashData.LoRaBW];;
TxConfigGeneric.lora.Coderate = LORA_CODINGRATE;
TxConfigGeneric.lora.CrcMode = true;
TxConfigGeneric.lora.IqInverted = LORA_IQ_INVERSION_ON;
TxConfigGeneric.lora.LengthMode = LORA_FIX_LENGTH_PAYLOAD_ON;
TxConfigGeneric.lora.LowDatarateOptimize = RADIO_LORA_LOWDR_OPT_AUTO;
TxConfigGeneric.lora.PreambleLen = LORA_PREAMBLE_LENGTH;
TxConfigGeneric.lora.SpreadingFactor = LORA_SPREADING_FACTOR;
Radio.RadioSetTxGenericConfig(MODEM_LORA,&TxConfigGeneric,RamFlashData.OutputPower,TX_TIMEOUT_VALUE);
Radio.SetPublicNetwork(true);
RxConfigGeneric_t RxConfigGeneric;
RxConfigGeneric.lora.Bandwidth = Bandwidths[RamFlashData.LoRaBW];;
RxConfigGeneric.lora.Coderate = LORA_CODINGRATE;
RxConfigGeneric.lora.CrcMode = true;
RxConfigGeneric.lora.IqInverted = LORA_IQ_INVERSION_ON;
RxConfigGeneric.lora.LengthMode = LORA_FIX_LENGTH_PAYLOAD_ON;
RxConfigGeneric.lora.LowDatarateOptimize = RADIO_LORA_LOWDR_OPT_AUTO;
RxConfigGeneric.lora.PreambleLen = LORA_PREAMBLE_LENGTH;
RxConfigGeneric.lora.SpreadingFactor = LORA_SPREADING_FACTOR;
// RxConfigGeneric.lora.StopTimerOnPreambleDetect = 0;
Radio.RadioSetRxGenericConfig(MODEM_LORA,&RxConfigGeneric,true,LORA_SYMBOL_TIMEOUT);
Radio.SetPublicNetwork(true);
SF : BW | Result |
12 : 125 | Rx Error |
12 : 250 | Successful tx rx |
12 : 500 | Successful tx rx |
11 : 250 | Successful tx rx |
11 : 250 | Successful tx rx |
11 : 500 | Successful tx rx |
10 : 125 | Rx Error |
10 : 250 to 7 : 500 | Successful tx rx |
Then, I changed TxConfigGeneric.lora.LowDatarateOptimize = RADIO_LORA_LOWDR_OPT_AUTO; to
TxConfigGeneric.lora.LowDatarateOptimize = RADIO_LORA_LOWDR_OPT_ON;
After this change, SF10:125 BW is working, but SF12:125 BW is still not working(Rx Error is coming)
2025-03-11 12:27 AM
Hi @Tesla DeLorean ,
The Rx and Tx timeouts I have used are given below. I am setting the module back to Rx mode after all radio callbacks (OnRxError, OnRxTimeout, OnTxTimeout, and OnTxDone).
#define RX_TIMEOUT_VALUE 0xFFFF
#define TX_TIMEOUT_VALUE 10000 //10 sec