2025-09-08 9:23 AM - edited 2025-09-08 10:57 AM
I am implementing a system with two STM32H753 microcontrollers. MCU1 reads ADC data and sends it over UART to MCU2 using UART DMA on ADC conversion. MCU2 reads data from UART via DMA and is supposed to do some filtering (among other things) to the received data. Earlier, all of the tasks were done by a single MCU (hence it was simpler, as we had access to the ADC data buffer already).
The issue I am facing is that the UART Receive DMA is never triggering the HAL_UART_RxCpltCallback() callback no matter what I do. I have tried the same with UART_Receive_IT() with no results either.
To help me ensure that it is not a configuration issue, I configured the same UART in a separate project (which is more of a simpler example of what I am trying to do) and verified my configuration to be working (posted about it earlier).
2025-09-08 11:06 AM
Did you enable the NVIC?
2025-09-08 11:07 AM
Light on details here. Gotta be an issue somewhere. Wiring or code.
Here's an example of how to use HAL_UART_Receive_DMA that works:
2025-09-08 11:23 AM
NVIC is enabled, so is the DMA Stream interrupt. The configuration is the same as my other question I posted here.
That is supposed to be an isolated subset of the main project, but somehow when I put the changes from that minimal example into the main project they do not work.
2025-09-08 11:30 AM
Are you still using 1-byte transfers? (You mentioned something about sending ADC readings.)
The (Rx) DMA won't complete until it transfers the length you requested, so the other side has to send exactly that many.
A key setting in the example TDK mentioned:
> #define RXBUFFERSIZE TXBUFFERSIZE
2025-09-08 11:38 AM
Currently still using 1-byte transfers, yes. Once I get the UART Callback working correctly I will update the sizes to be the appropriate size (18 bytes for 9 16-bit ADC values in my case).
My receiving side looks something like:
auto status = HAL_UART_Receive_DMA(huart3_, rx_buffer_.data(), 1);
And the sending side looks like:
HAL_UART_Transmit_DMA(huart3_, data, 1);
Additionally, I did check the UART TX pin on the sender side with an oscilloscope and it does indeed send the byte as expected.
2025-09-08 11:44 AM
Double-check the spelling of routine's name. Or - better yet - copy the name from the header file or HAL manual.
2025-09-08 12:00 PM
Thanks for the suggestion, I did copy the function name from the HAL file in the project, so I am sure it is not something like a typo somewhere.
2025-09-08 12:34 PM
> but somehow when I put the changes from that minimal example into the main project they do not work.
So probably an issue with the integration then. Perhaps an overrun.
Debug the program. When it "doesn't work", hit pause an examine the state of the huart handle and relevant UART/DMA registers.
2025-09-08 12:46 PM
Thanks for pointing that out. When I debug, I set a breakpoint on the HAL_UART_RxCpltCallback which is never hit. I added a live expression so that I can see the state of the uart handle while the project runs. Here is what I am seeing
I see that the error code is 0, which is good, since it means no error. However, the gState and RxState are non-zero, and I could not find a definition for them in the generated code. I think this might be important?