cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723VGTx DMA TX reboot use fail

YutinhLin
Associate II

Cube setting is OK!

First run OK!

if(HAL_OK != HAL_UART_Transmit(CO_INFO.channel, co_dma_tx_data, send_len, 0xFFFF))
    {
        DEBUG_PRINT("CO MODULE SEND DATA ERROR!!\r\n");
    }
 
Then setting OK!
if(HAL_OK==HAL_UART_AbortReceive(CO_INFO.channel))
if(HAL_OK==HAL_UARTEx_ReceiveToIdle_DMA(CO_INFO.channel,(uint8_t*)CO_INFO.RX.data,CO_UART_BUF_LENGTH))
 
But second run Fail !!
if(HAL_OK != HAL_UART_Transmit(CO_INFO.channel, co_dma_tx_data, send_len, 0xFFFF))
 
trace HAL_UART_Transmit() function
if (huart->gState == HAL_UART_STATE_READY) 
the huart->gState value always 0x33
so always return HAL_BUSY
1 REPLY 1
TDK
Super User

The functions you listed will work as expected with the latest HAL library. You are probably executing a DMA transmit somewhere that you've forgotten about or you are using 3+ year old library code.

If you still have problems, please provide a full compile-able project which shows the issue.

 

Here is code which functions without error on a new STM32H723 project:

  if (HAL_UART_Transmit(&huart4, data, sizeof(data), HAL_MAX_DELAY) != HAL_OK) {
  	Error_Handler();
  }
  if (HAL_UART_AbortReceive(&huart4) != HAL_OK) {
  	Error_Handler();
  }
  if (HAL_UARTEx_ReceiveToIdle_DMA(&huart4, &data, sizeof(data)) != HAL_OK) {
  	Error_Handler();
  }
  if (HAL_UART_Transmit(&huart4, data, sizeof(data), HAL_MAX_DELAY) != HAL_OK) {
  	Error_Handler();
  }

 

TX and RX states for UART are independent and are handled correctly within HAL.

 

Related/duplicate:

HAL_UART_Transmit_DMA 使用 HAL_UART_AbortReceive 後異常 - STMicroelectronics Community

If you feel a post has answered your question, please click "Accept as Solution".