Skip to main content
Visitor II
February 5, 2021
Solved

HAL_UART_Transmit_DMA issues in FreeRTOS

  • February 5, 2021
  • 2 replies
  • 1871 views

Hi,

I met a strange issue and wish to get help.

I wish to connect PC by UART. I try to use DMA but failed.

The following is my test code for DMA.

main () {

initialization code from CubeMX

HAL_UART_Transmit_DMA(&UART_Handle_Console, (uint8_t*)(listbuffer), len);

  while ( HAL_UART_GetState(&UART_Handle_Console) != HAL_UART_STATE_READY);

HAL_UART_Transmit_DMA(&UART_Handle_Console, (uint8_t*)(listbuffer), len);

while ( HAL_UART_GetState(&UART_Handle_Console) != HAL_UART_STATE_READY);

vTaskStartScheduler();

}

If comment out vTaskStartScheduler, everything is OK.

If leave vTaskStartScheduler, the first DMA statement can run but PC got nothing. The second DMA statement cannot run because HAL_UART_GetState(&UART_Handle_Console) is always busy TX.

The above is my test code . My purpose is to use binary semaphore to control UART DMA connected to PC.

Thanks,

    This topic has been closed for replies.
    Best answer by Jianxuan He

    It is OK now after shrunk the size of heap.

    Thanks for your support!

    2 replies

    Visitor II
    February 5, 2021

    Can you put your code in code section please?​

    Jianxuan HeAuthorAnswer
    Visitor II
    February 6, 2021

    It is OK now after shrunk the size of heap.

    Thanks for your support!

    Graduate II
    February 6, 2021