cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_DMA_Pause() does not pause the UART receiving bytes

MGuth.1
Associate III

Hi all

I'm using a Nucleo U575 board for reading a GNSS module. I configured the USART2 port with DMA (in circular mode, port 0 as it's peripheral to memory), Request is USART2_RX, Interrupts for USART2 and GPDMA1 are enabled and it works just fine. I'm calling

uint8_t gnss_message[100] = {0};
HAL_UART_Receive_DMA(&huart2, gnss_message, sizeof(gnss_message));

just before entering the while-loop in main(). Therefore I'm receiving the NMEA messages of my GNSS module continusously.

To have a constant array I'd like to pause the DMA action during some operation:

HAL_StatusTypeDef hal_return = HAL_OK;
hal_return = HAL_UART_DMAPause(&huart2);
/**  some action on gnss_message array **/
hal_return = HAL_UART_DMAResume(&huart2);

When debugging the code, hal_return stays HAL_OK all the time. So I assume the HAL_UART_DMAPause/Receive() function is called properly. But for some reason, gnss_message still gets updated with the incoming bytes during /** some action **/

What did I miss? What's the correct way to call HAL_UART_DMAPause() and HAL_UART_DMAResume()?

Thanks in advance

1 REPLY 1
MGuth.1
Associate III

I'm still struggling with pausing the UART_DMA process as described above. I can use it without any issue in a clean new project. But when including the functionality to my ThreadX/TouchGFX project, the DMA process doesn't pause.

Is there a incompatibility with ThreadX and HAL_UART_DMA functions? Does anyone know something about it? Or any other reasons why the HAL_UART_DMA_Pause() function may not work properly?