Skip to main content
Associate
March 8, 2025
Question

LoRa Point-to-Point Communication Issue with SF12 and BW125 on STM32WLE5CCU6, (RX Errors)

  • March 8, 2025
  • 2 replies
  • 1027 views

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."

Setup Details:

  • Chipset: STM32WLE5CCU6
  • SDK Version: STM32Cube_FW_WL_V1.3.0
  • Communication Type: Point-to-point LoRa 
  • Project: I started by importing the SubGHz_Phy_PingPong.ioc file and generated code with MX. I then copied the necessary lines of code for the SubghzApp_Init() function from the SubGHz_Phy_PingPong example project.
    • 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.

2 replies

STTwo-32
Technical Moderator
March 8, 2025

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

Associate
March 11, 2025

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 : BWResult
12 : 125Rx Error
12 : 250Successful tx rx
12 : 500Rx Error

11 : 125

Successful tx rx
11 :  250  Rx Error
11 : 500Successful 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 : BWResult
12 : 125Rx Error
12 : 250Successful tx rx
12 : 500Successful tx rx

11 :  250 

Successful tx rx
11 :  250 Successful tx rx
11 : 500Successful 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)

 
STTwo-32
Technical Moderator
April 4, 2025

Hello @Akhil_Joseph 

Are you sure that there is no issue with your HW. Have you tested the same behavior on our NUCLEO-WL55JC1. 

Best Regards.

STTwo-32

Tesla DeLorean
Guru
March 8, 2025

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

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Associate
March 11, 2025

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

 

Tesla DeLorean
Guru
April 4, 2025

Just saying watch how things align.

In the older ST/Semtech code there was also a "Continuous Receive" mode

Also, it's Radio, it can be a fickle medium, the spreading factor slows things down a lot, you only want it for very small/short messages.

Watch that it's Half Duplex, and how quickly/efficiently you can leave TX and enter RX, and that you're in RX mode when the data is being sent to you.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..