UART_DMA(LPUART) working oddly on STM32WB55
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-24 3:20 PM
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:
What 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.
- Labels:
-
DMA
-
STM32WB series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-24 3:37 PM
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.
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);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-25 12:47 AM
@TDK​ I've updated the post. Sorry for the sorry for the inconvenience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-25 1:13 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-25 5:22 AM
I have just updated. But the problem persists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-27 2:05 AM
what do you mean by "Line 1422 has nothing on it in the latest library, so you must be on a different version"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-28 3:58 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 6:19 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-07 2:13 PM
in my case it got working on its own :)
