Is CDC_Transmit_FS slower than UART with DMA?
Hello! I'm using a STM32F407VET6 and receiving data through UART with DMA to send it back by the USB using CDC_Transmit_FS.
I tested the UART echoing RX and TX, it worked and showed the data like "@HEAD=TEST1,AAAA,BBBB,CCCC..." which is OK, but now when I send it by USB I only receive "@HEA@HEA@HEA"
This is the function where I call the CDC_Transmit_FS
void UserDataTreatment(UART_HandleTypeDef *huart, uint8_t* pData, uint16_t Size){
/*
* This function might be called in any of the following interrupt contexts :
* - DMA TC and HT events
* - UART IDLE line event
*
* pData and Size defines the buffer where received data have been copied, in order to be processed.
* During this processing of already received data, reception is still ongoing.
*
*/
uint8_t* pBuff = pData;
uint8_t i;
/* Implementation of loopback is on purpose implemented in direct register access,
in order to be able to echo received characters as fast as they are received.
Wait for TC flag to be raised at end of transmit is then removed, only TXE is checked */
for (i = 0; i < Size; i++){
//while (!(__HAL_UART_GET_FLAG(huart, UART_FLAG_TXE))) {}
//huart->Instance->DR = *pBuff;
//uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
CDC_Transmit_FS(pBuff, sizeof(pBuff));
pBuff++;
}
}Thank you!
