Lora-E5 PinG-Pong example

Hi all,

I’m working with Lora-E5 device but for now I’d like to have the Ping Pong example (simple Lora not LoraWan just Lora com between 2 device), but I can’t find a suitable example and I can’t adapt the STM32 base project to Lora-E5, is anyone have this example for Lora-E5?

1 Like

Hi Simon1
I wish to do the same, use the onboard stm32, but cant find any examples (well, that works). Did you have any luck?

Many Thanks
Scott

1 Like

Hello,

I have the same problem…

When I try to replace LoRaWAN layer by a ping pong application, SUBGHZSPI_Transmit function return HAL_SUBGHZ_ERROR_TIMEOUT.

I tried to use the hardware configuration of this repo (creating a new project from the .ioc file) : GitHub - danak6jq/Seeed-LoRa-E5: LoRaWAN end node built from scratch using CubeMX for WLE5x in the LoRa-E5
But in this case, radio events never occured (OnTxDone onRxDone…).

Did you find a solution ?

Thanks

Hi,

I made a simple LoRa PingPong example between two Lora e5 mini
https://github.com/johflo/Seeed-Lora-e5.
It’s based on danak6jq (HW configuration of the Lora e5 mini, link above) and of the PingPong example from STM https://github.com/STMicroelectronics/STM32CubeWL/tree/main/Projects/NUCLEO-WL55JC/Applications/SubGHz_Phy/SubGHz_Phy_PingPong

Best Regards,
Johannes

Hello im using wio e5 mini board i just used your code by flashing one board with isMaster = true and another false it gave PING PONG
APPLICATION_VERSION: V1.3.0
MW_RADIO_VERSION: V1.3.0

LORA_MODULATION
LORA_BW=125 kHz
LORA_SF=7
248s943:rand=0
and stopped nothing printing further.

Hi,

you dont need to set Master.
Just flash on two boards. I tested it last week and it runs as it should.

is there any hex file that i can flash?. i tried to flash without any changes i had same result.
I even erased all memory and tried to flash even that did not work.
struggling a lot with this project(boards).

At the moment I don’t have access to the system. Probably I can send you on Monday the hex file.

Seeed-LoRa-E5_PingPong.zip (43,4 KB)

Hi Johannes,
I just found your ping pong example - exactly what I was looking for, so thanks for making it public!

However, I can’t get it to work (I think), maybe because I am using E5-LE, not just ‘E5’ devices.
I have one E5-LE mini and one E5-LE.
The E5-LE starts up normally, printing something along the lines of

APPLICATION_VERSION: V1.3.0
MW_RADIO_VERSION:    V1.3.0
---------------
LORA_MODULATION
LORA_BW=125 kHz
LORA_SF=7
0s026:rand=750

But then nothing happens. If I put a break in main, it arrives there one time, then, when I press go again, it goes into some low power sleep, and never comes back.
May I ask if this is how it is supposed to work? I.e. I’m thinking, maybe it is sleeping, waiting for another board? But I am not sure it even sent something itself, before going into sleep. Not in an obvious way, anyway?

Hope you may be able to enlighten me, some time when the Christmas food has been processed :slight_smile:

Regards,
Micael

Hi,

At the moment I’m in vacation and far away from my notebook.
I will look at the code at the beginning of the year.

Regards Johannes

Hi

Set the breakpoint in the subghz_phy_app.c in the line Radio.Rx(RX_TIMEOUT_VALUE + random_delay); .

Then check where it could be the problem.

Johannes

I have stepped the code, and I think that there’s some timer missing, nothing ever times out. Afaict, there’s no error happening while setting up the RxTimeoutTimer, it just never times out. So therefore, nothing ever happens, it simply goes into power save, waiting for an interrupt than never happens (because none of the nodes ever gets to send anything).

I am using Cube 1.17.0, if this is relevant. I’ll keep on debugging…

With my modified main - adding once trancmit PING at the beginning - the project started. I also changed the power in function BSP_RADIO_GetTxConfig(void) to LP instead of HP because I have a Wio E5 LE. RSSI with 5-8 cm antennas was -35 dBm at a distance of up to one meter, but it’s possible to further i

mprove the connection quality.

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.c
  * @brief          : Main program body
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2022 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "app_subghz_phy.h"
#include "gpio.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

#include "radio.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
#define PING "PING"
static uint8_t BufferTx[255];

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/

/* USER CODE BEGIN PV */

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_SubGHz_Phy_Init();
  /* USER CODE BEGIN 2 */
  memcpy(BufferTx, PING, sizeof(PING) - 1);
  Radio.Send(BufferTx, 64);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
    MX_SubGHz_Phy_Process();

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Configure LSE Drive Capability
  */
  HAL_PWR_EnableBkUpAccess();
  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

  /** Configure the main internal regulator output voltage
  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE|RCC_OSCILLATORTYPE_MSI;
  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
  RCC_OscInitStruct.MSIState = RCC_MSI_ON;
  RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_11;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

  /** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK3|RCC_CLOCKTYPE_HCLK
                              |RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
                              |RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  {
    Error_Handler();
  }
}

/* USER CODE BEGIN 4 */

/* USER CODE END 4 */

/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void)
{
  /* USER CODE BEGIN Error_Handler_Debug */
  /* User can add his own implementation to report the HAL error return state */
  __disable_irq();
  while (1)
  {
  }
  /* USER CODE END Error_Handler_Debug */
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{
  /* USER CODE BEGIN 6 */
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */