Skip to main content
Visitor II
February 16, 2020
Question

Can we send and receive DMA UART at the same time ?

  • February 16, 2020
  • 3 replies
  • 1145 views

Hello,

I find in HAL_UART_Transmit_DMA the following code:

/* check that tx process is not already ongoing */
if (huart->gstate == HAL_UART_STATE_READY)
{
 .....
 return HAL_OK;
}
else
{
 return HAL_BUSY;
}

As far as I understand gstate, is for both tx and rx, so why we check that it is ready, instead of checking that there is no tx busy ?

Does it mean we can't send during reception of DMA in UART ?

Thank you

    This topic has been closed for replies.

    3 replies

    Graduate II
    February 16, 2020

    HW should be capable of full-duplex operation with DMA

    Super User
    February 16, 2020

    Examples by Tilen Majerle demonstrate TX and RX DMA simultaneously.

    So, yes. But these examples do not use HAL API.

    -- pa

    Visitor II
    February 17, 2020

    HAL covers only a small fraction of the features of STM32 MCUs.

    All STM32 MCUs have independent DMA channels for UART transmit and receive. Check the DMA request mapping / DMAMUX mapping tables in your reference manual.

    DMA for transmit and receive can be enabled/disabled independently, see the DMAT/DMAR bits in UARTx->CR3.