vimalraj
Junior Member level 2
Hi guys,
I have generated a code from STMCUBEMX for UART using DMA for Tx and Rx. The DMA is used so that the main function should not be disturbed.
I did not call these below functions in the while loop.
These receiving function is triggered once the start bit is find. The communication is proper but if I disconnect and connect the Rx line, no data is received. If I reset the program then the data is received and the same problem occurs.
If I called the receiving function in while loop then it is working fine which delays the main operations. So I wanted it to run in background.
suggest what changes need to be done.
I have generated a code from STMCUBEMX for UART using DMA for Tx and Rx. The DMA is used so that the main function should not be disturbed.
I did not call these below functions in the while loop.
Code:
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
if(Fault_status != 1)
{
for(int i=0;i<=12;i++)
{
data_tx[i]=data_tx1[i];
}
}
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Receive_DMA(&huart3,data_rx,sizeof(data_rx));
if(data_rx[0]==0x3A)
{
// user code
}
}
These receiving function is triggered once the start bit is find. The communication is proper but if I disconnect and connect the Rx line, no data is received. If I reset the program then the data is received and the same problem occurs.
If I called the receiving function in while loop then it is working fine which delays the main operations. So I wanted it to run in background.
suggest what changes need to be done.