How to Set Up Point-to-Point Communication Between Two LoRa-E5 Mini Modules?

Does a simple sketch like blink work without any problems?

Yes, no issues with any other sketch that doesn’t use RadioLib,

The exact same happens with the dev kit board (that you can see in the picture)

When I tried compiling again after a long time, I got a compilation error.
Please provide me with the compilation information, such as the BSP version, Radiolib version, and board selection name.

BSP version: 2.11.0
RadioLib version: 6.6.0
Board selection name: Lora Boards - LoRa-E5 mini

  int state = radio.begin(922.6, 125.0, 12, 5, 0x12, 13, 8, 1.7, 0);


  if (state == RADIOLIB_ERR_NONE) {
    Serial.println("radio.begin() success!");
  }
  else {
    Serial.print("failed, code ");
    Serial.println(state);
    errorBlink(4);                           // error [[ 4 ]]
  }

Does that mean there is an error where the LED flashes four times?

No, fixed led, radio.begin() never returns

I would assume radio begin fail would have to be with the pin definitions, may need gpio vs physical pin or vice versa, maybe pins backwards? IMO maybe a pullup pin/ chip select to activate the chip?

After uploading with STLink, are you pressing the reset button on the WioE5mini board to start it?

I am trying to reproduce the same issue you are having, but I cannot reproduce it. Please let me know if there is anything else I can try.
This is the sketch used for confirmation and the output to the serial monitor.

#include <RadioLib.h>           // 6.6.0  RadioLib by Jan Gromes (Library manager)

STM32WLx radio = new STM32WLx_Module();
static const uint32_t rfswitch_pins[] = {PA4, PA5, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = {
  {STM32WLx::MODE_IDLE,  {LOW,  LOW}},
  {STM32WLx::MODE_RX,    {HIGH, LOW}},
  {STM32WLx::MODE_TX_HP, {LOW, HIGH}},  // for LoRa-E5 mini
//  {STM32WLx::MODE_TX_LP, {HIGH, HIGH}},   // for LoRa-E5-LE mini
  END_OF_MODE_TABLE,
};

void setup() {
  Serial.begin(115200);
  delay(2000);

  Serial.print("Master UID "); Serial.println(*((uint32_t*)0x1FFF7580), HEX);

  pinMode(LED_RED, OUTPUT);
  digitalWrite(LED_RED, HIGH);

  radio.setRfSwitchTable(rfswitch_pins, rfswitch_table);

  // int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, \
  // uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, \
  // uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
  int state = radio.begin(922.6, 125.0, 12, 5, 0x12, 13, 8, 1.7, 0);


  if (state == RADIOLIB_ERR_NONE) {
    Serial.println("radio.begin() success!");
  }
  else {
    Serial.print("failed, code ");
    Serial.println(state);
    digitalWrite(LED_RED, LOW); while(1);
  }

  Serial.println("END of setup()");
}

void loop() 
{
}

08:34:56.334 -> Master UID 535EE2F
08:34:56.343 -> radio.begin() success!
08:34:56.343 -> END of setup()

This is just my guess.
The firmware may differ depending on the country of shipment. Therefore, the argument of radio.begin() may be inappropriate and cause a hang.

EDIT:
Looking at the photo, there are many pins that have not been soldered, and the soldering on the STLink pins looks unstable. Is this okay?

3 Likes

I will send you the hex file that I built and confirmed to be working. Please upload it and check that it works.
Oren_SX126x_PingPong.ino.zip (44.9 KB)

Please build the sketch I posted for confirmation, check whether it works or not, and then send me the hex file.

1 Like

Hey, still stuck at radio.begin() unfortunately with your .hex file, with both boards (to ensure it isn’t the soldering on the pins)

I also tried on a different computer with STM32CubeProg, same. Maybe it’s my ST Link V2 ? Though sketches do work, it just stay stuck at radio.begin() instruction

SX126x_PingPong.zip (863 Octets)

Just to be sure, please send the hex file you built instead of the ino file.

On which line of src/modules/SX126x/SX126x.cpp does it stop, and in what state?

Serial.print("Master UID "); Serial.println(*((uint32_t*)0x1FFF7580), HEX);

Will this line be executed before radio.begin()?

Oops my bad seems like I still wasn’t fully awake haha
SX126x_PingPong.ino.hex.zip (62,8 Ko)

Yes, it does print the Master UID

It stops in state -2, on line RadioLib/src/modules/SX126x/SX126x.cpp at 954477b0c0589e6373692ce569ca117191667c30 · jgromes/RadioLib · GitHub
Though, findchip never returns so it doesn’t throw the error, but I see it looping memory to find the chip version (which he never does)

Will this line be executed before radio.begin()?

Why not post it here?

Yes it is executed before radio.begin() since it prints.

It seems like an isolated case only on my part (with 2 boards having the same chip) as it doesn’t work on any RadioLib version.
Maybe I did something wrong while unlocking RDP, or maybe my STLink V2 is defective

Did you try erasing the entire chip before writing to it?

1 Like

Hi, this code worked fine for me. Can you give it a try and let me know if you hit the same issue?
LoRa_code.zip (4.5 KB)

2 Likes

@msfujino Yes I tried a full erase of the chip

@Niki_Nagar same as the others. Didn’t you have the same issue as me ?

Oren,
This is the log when I uploaded. Is there any difference from your log?

  07:22:43 : STM32CubeProgrammer API v2.15.0 | Windows-64Bits 
  07:22:46 : UR connection mode is defined with the HWrst reset mode
  07:22:46 : ST-LINK SN  : 112D060032124353354B4E00
  07:22:46 : ST-LINK FW  : V2J37S7
  07:22:46 : Board       : --
  07:22:46 : Voltage     : 3.13V
  07:22:46 : SWD freq    : 4000 KHz
  07:22:46 : Connect mode: Under Reset
  07:22:46 : Reset mode  : Hardware reset
  07:22:46 : Device ID   : 0x497
  07:22:46 : Revision ID : Rev Y
  07:22:46 : Debug in Low Power mode is not supported for this device.
  07:22:46 : UPLOADING OPTION BYTES DATA ...
  07:22:46 :   Bank          : 0x00
  07:22:46 :   Address       : 0x58004020
  07:22:46 :   Size          : 96 Bytes
  07:22:46 :   Bank          : 0x01
  07:22:46 :   Address       : 0x58004080
  07:22:46 :   Size          : 8 Bytes
  07:22:46 : UPLOADING ...
  07:22:46 :   Size          : 1024 Bytes
  07:22:46 :   Address       : 0x8000000
  07:22:46 : Read progress:
  07:22:46 : Data read successfully
  07:22:46 : Time elapsed during the read operation is: 00:00:00.006
  07:25:31 : Memory Programming ...
  07:25:31 : Opening and parsing file: Oren_SX126x_PingPong.ino.hex
  07:25:31 :   File          : Oren_SX126x_PingPong.ino.hex
  07:25:31 :   Size          : 40.83 KB 
  07:25:31 :   Address       : 0x08000000 
  07:25:31 : Erasing memory corresponding to segment 0:
  07:25:31 : Erasing internal memory sectors [0 20]
  07:25:31 : Download in Progress:
  07:25:32 : File download complete
  07:25:32 : Time elapsed during download operation: 00:00:01.265
  07:25:32 : Verifying ...
  07:25:32 : Read progress:
  07:25:32 : Download verified successfully 
1 Like

@msfujino here’s my uploading log

13:06:32 : STM32CubeProgrammer API v2.20.0 | Windows-64Bits 
13:06:35 : UR connection mode is defined with the HWrst reset mode
13:06:35 : UR connection mode is defined with the SWrst reset mode
13:06:35 : ST-LINK SN  : 37FF71064E573436741E1343
13:06:35 : ST-LINK FW  : V2J46S7
13:06:35 : Board       : --
13:06:35 : Voltage     : 3.28V
13:06:35 : SWD freq    : 4000 KHz
13:06:35 : Connect mode: Normal
13:06:35 : Reset mode  : Software reset
13:06:35 : Device ID   : 0x497
13:06:35 : Revision ID : Rev Y
13:06:35 : Debug in Low Power mode is not supported for this device.
13:06:36 : UPLOADING OPTION BYTES DATA ...
13:06:36 :   Bank          : 0x00
13:06:36 :   Address       : 0x58004020
13:06:36 :   Size          : 96 Bytes
13:06:36 :   Bank          : 0x01
13:06:36 :   Address       : 0x58004080
13:06:36 :   Size          : 8 Bytes
13:06:36 : UPLOADING ...
13:06:36 :   Size          : 1024 Bytes
13:06:36 :   Address       : 0x8000000
13:06:36 : Read progress:
13:06:36 : Data read successfully
13:06:36 : Time elapsed during the read operation is: 00:00:00.007
13:06:36 : Disconnected from device.
13:06:37 : UR connection mode is defined with the HWrst reset mode
13:06:37 : UR connection mode is defined with the SWrst reset mode
13:06:37 : ST-LINK SN  : 37FF71064E573436741E1343
13:06:37 : ST-LINK FW  : V2J46S7
13:06:37 : Board       : --
13:06:37 : Voltage     : 3.28V
13:06:37 : SWD freq    : 4000 KHz
13:06:37 : Connect mode: Normal
13:06:37 : Reset mode  : Software reset
13:06:37 : Device ID   : 0x497
13:06:37 : Revision ID : Rev Y
13:06:37 : Debug in Low Power mode is not supported for this device.
13:06:37 : UPLOADING OPTION BYTES DATA ...
13:06:37 :   Bank          : 0x00
13:06:37 :   Address       : 0x58004020
13:06:37 :   Size          : 96 Bytes
13:06:37 :   Bank          : 0x01
13:06:37 :   Address       : 0x58004080
13:06:37 :   Size          : 8 Bytes
13:06:37 : UPLOADING ...
13:06:37 :   Size          : 1024 Bytes
13:06:37 :   Address       : 0x8000000
13:06:37 : Read progress:
13:06:37 : Data read successfully
13:06:37 : Time elapsed during the read operation is: 00:00:00.008
13:06:48 : Opening and parsing file: Oren_SX126x_PingPong.ino.hex
13:06:48 : Memory Programming ...
13:06:48 :   File          : Oren_SX126x_PingPong.ino.hex
13:06:48 :   Size          : 40.83 KB 
13:06:48 :   Address       : 0x08000000
13:06:48 : Erasing memory corresponding to segment 0:
13:06:48 : Erasing internal memory sectors [0 20]
13:06:49 : Download in Progress:
13:06:49 : File download complete
13:06:49 : Time elapsed during download operation: 00:00:01.265
13:06:49 : Verifying...
13:06:49 : Read progress:
13:06:50 : Time elapsed during verifying operation: 00:00:00.284
13:06:50 : Download verified successfully 
13:06:50 : RUNNING Program ... 
13:06:50 :   Address:      : 0x08000000
13:06:50 : Application is running, Please Hold on...
13:06:50 : Start operation achieved successfully

Btw I’ve opened an issue on RadioLib: Seeed Wio E5 mini stuck at radio.begin with no error code · Issue #1577 · jgromes/RadioLib · GitHub

I’m not sure if it has any effect, but the following parts are different.

STM32CubeProgrammer API v2.15.0    v2.20.0
ST-LINK FW  : V2J37S7              V2J46S7
Connect mode: Under Reset          Normal
Reset mode  : Hardware reset       Software reset
1 Like