Skip to main content
Associate II
December 26, 2024
Solved

UART not working with LoRaWAN

  • December 26, 2024
  • 1 reply
  • 1273 views

Hi, I'm using the LoRaWAN end node example from the stm32cubewl v1.3.0. The board im using is the RAK3172 based on the stm32wle5ccu6 chip. The application i want to build reads data from a modbus using UART and sends it through lorawan. I have assigned UART1 in the platform settings for debugging in lorawan and UART2 for reading from modbus. When I tested both separately the work perfectly. However when I integrate both together, Lorawan still works and uart 1 works properly, however uart2 stops working. I connected a USB to ttl converted to uart2 to see the if it was sending data, it sends data till Lorawan process starts running after that it doesnt send any data. 

I am mostly using the code that is in STM32Cube_FW_WL_V1.3.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\LoRaWAN_End_Node. The only changes that I have made are to write a function to read from modbus in main.c and call that function in lora_app.c just below the line EnvSensors_Read(&sensor_data);

Yet UART doesnt send any data when called from inside the sendTxData() function. Can someone please help.

 

I am attaching the .ioc, lora_app.c and main.c for reference

Best answer by KCB11

this didnt work but calling MX_USART2_UART_Init() everytime before using uart2 fixed it for me.

1 reply

KCB11AuthorBest answer
Associate II
December 30, 2024

this didnt work but calling MX_USART2_UART_Init() everytime before using uart2 fixed it for me.

cxiao.2
Associate II
February 3, 2025

You can try executing HAL-UART_deInit (&uart2) before initializing the serial port