I'm trying to make my STM32F3Dsicovery just loop back some data over USB however with code below I loosing approximate every 2nd character. If I enable the #if clause the missing characters drop to approximately 2%.
I'm using minicom as terminal
$ minicom -D /dev/ttyACM0
and the linux kernel 4.4.87 stock cdc_acm driver
I'm pasting 50 characters into the terminal. They seems to be sent as 50 single character packages.
Apart from the code below it's as generated from CubeMX, imported in eclipse as Makefile-project.
Any idea what I'm doing wrong?
I have the following in usb_cdc_if.c
/* USER CODE BEGIN PRIVATE_VARIABLES */
#define USER_DATA_SIZE (1<<8)
/* USER CODE END PRIVATE_VARIABLES */
static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
/* USER CODE BEGIN 6 */
if (((ptrIn+1) & (USER_DATA_SIZE-1))!=ptrOut)
for (int i=0;i<50;i++)
/* USER CODE END 6 */
and in main()
/* USER CODE BEGIN WHILE */
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
uint32_t rLen = CDC_Read(tBuffer,100);
/* USER CODE END 3 */