Skip to main content
March 24, 2022
Question

UART_DMA(LPUART) working oddly on STM32WB55

  • March 24, 2022
  • 4 replies
  • 6123 views

Hello, I have been trying to send and receive data through UART using DMA on STM3WB55. Everything was working properly but suddenly HAL_UART_Transmit_DMA started to work unproperly: the program gets stuck in the Hard Fault function. I am calling HAL_UART_Transmit_DMA inside the function HAL_UART_RxCpltCallback. When I call it in the while loop in the main.c file, the program works good. My buffers are 71 and 273 long. Later I tried HAL_UART_Transmit and HAL_UART_Transmit_IT inside HAL_UART_RxCpltCallback but none of them works anymore. When I comment this line, the program works good.

I attached the main.c , stm32wbxx_it.c and usart.c files.

Here is the call stack untill it falls into the hard fault function:

0693W00000Lvg9IQAR.pngWhat I want to do is to send data after the reception is complete. The reception through HAL_UART_Receive_DMA seems to be correct. Just the transmit. Any clue? Thank you.

This topic has been closed for replies.

4 replies

TDK
March 24, 2022

Would be helpful to see the complete code. Where is the definition of res?

Line 1422 has nothing on it in the latest library, so you must be on a different version.

https://github.com/STMicroelectronics/STM32CubeWB/blob/master/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_uart.c#L1422

The code you've posted won't even compile since the brackets are unbalanced.

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
 
if(huart==&hlpuart1)
 
state = HAL_UART_Transmit_DMA(&hlpuart1,(uint8_t*)res,(uint16_t)NMEA_COORD_LEN);
 
}
 
}

"If you feel a post has answered your question, please click ""Accept as Solution""."
March 25, 2022

@TDK​  I've updated the post. Sorry for the sorry for the inconvenience

Javier1
Principal
March 25, 2022

Did you just Updated stm32cubeIDE to version 1.9.0?

I had problems because they changed the compiler to gcc10, it gave me similar problems

hit me up in https://www.linkedin.com/in/javiermuñoz/
March 25, 2022

I have just updated. But the problem persists.

March 28, 2022

I finally made it work. I had just to change the length of my buffer from 71 to 70 or 72 and it started working properly. I'm not sure if DMA sympathize more with even lengths.

BIsma.2
Visitor II
March 1, 2023

How did you manage to make LPUART1 working in the first place. i wrote a simple code that transmit a char evry 500 Ms and it wont work

March 7, 2023

in my case it got working on its own :)