Question
Transmission problem Using of IDLE Line Flag in STM32F4 UART
Posted on July 17, 2015 at 06:00
HI,
I am using IDLE Flag to check the IDLE Bus condition in my UART Transmit routine. void serialOut(uint8_t Channel,uint8_t *data,uint8_t len) { uint8_t is_Rx_line_Idle=0; is_Rx_line_Idle = __HAL_UART_GET_FLAG(&huart1, UART_FLAG_IDLE); //len= strlen((char *)data); /* send the packet when Data is present in buffer and any ongoing Reception is complete */ if ((0 != len) && (data != (void*)0)&&(is_Rx_line_Idle))// && (RxCount[Channel] == 0)) { if (UART_A == Channel ) { HAL_UART_Transmit_IT(&huart1,(uint8_t *)data,len); } if (UART_B == Channel ) { HAL_UART_Transmit_IT(&huart6,(uint8_t *)data, len); //HAL_UART_Transmit_IT(&huart2,(uint8_t *)data, len); } } } The interesting thing i am facing is like, UART is not transmitting any byte. I am sending dummy byte @500 msec rate. But i send any byte to my UART everything working fine. that means UART start sending bytes at specified intervals. Why the first time UART is not sending the Data? why the IDLE line not set to 1 initially? Pl. help me to understand what the significance of IDLE flag and what is the good practices to use that? and when? Thanks Vinayak #uart-sending-problem-on-stm32f4