AnsweredAssumed Answered

UART Driver for STM32F413H

Question asked by Poonam Deoghare on Apr 23, 2018
Latest reply on Apr 23, 2018 by Clive One

Hi All,

I am working with STM32F413H disco kit. Configured UART2 driver with 4 wires(Tx,Rx,CTS,RTS).

I am using UART in interrupt mode. Trying to send and receive some data with loopback test.

But when UART_Recv_IT is getting called, it returns HAL_BUSY and I am not able to receive data which i have sent.

I am using STM32Cube V1.0 version 4.23.0. Is there any fault in the UART driver?

 

This is my code:-  I am calling call back functions as well.

uint8_t rxData[128], rxBuf[128];
uint8_t txData[128];
volatile uint16_t i = 0;
volatile uint16_t rxDone = 0;
volatile uint16_t txDone = 0;

 

 

    HAL_UART_Receive_IT(&huart2,rxData,1);
    //HAL_Delay(100);
    while(rxDone == 1){}
    HAL_UART_Transm    it_IT(&huart2,txData,6);
    HAL_Delay(100);
    while(txDone == 1){}
    HAL_UART_Receive_IT(&huart2,rxData,6);
        HAL_Delay(100);
    printf(" rxData is %s\n",rxData);

 

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
    txDone = 1;
}

 

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
      rxDone=1;
}

Outcomes