Question
Transferring large blocks of data over USART
Posted on April 28, 2016 at 15:20
Dear all,
I have problem transferring relatively large block data (>= 600 bytes) over USART. All blocks smaller than 600 bytes can be sent successfully from MCU and the host at the other end receives that correctly. I have the following routine with some timeout to send the data from MCU to the host: static void send_response(uint8_t *response, uint16_t frame_length) { for (int i = 0; i < frame_length; ++i) { USART_SendData(UART4, response[i]); timer.Start(TIMEOUT); while ((!timer.iselapsed()) && (USART_GetFlagStatus(UART4, USART_FLAG_TC) == RESET)); } } The logic seems to be pretty simple but it doesn't work for large frames and it seems that the USART_FLAG_TC is never set so the communication will not be successful. The limit of 600 bytes seems to be very low so I am almost sure that I am doing something wrong. Any help is highly appreciated. Regards, Dan