AnsweredAssumed Answered

Sending received data from PC (USB VCP) via UART in stm32

Question asked by kh.Mehran on Nov 19, 2016
Latest reply on Nov 20, 2016 by kh.Mehran
I'm trying to send received data from PC (USB VCP) using UART. I generated the code with CubeMx for "STM32f103c8t6" and modified the "CDC_Receive_FS" function to send received data  by UART in interrupt mode. Data with size of few bits are sent correct but bigger data is corrupted. when I send below data,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
receive,
1 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 20 21 22 23 24 2
I'm using "Tera term" and "RealTerm" for sending data. what should I do to fix it?!
Any help will be appreciated.


static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
     
{
  /* USER CODE BEGIN 6 */
     HAL_UART_Transmit_IT(&huart3,Buf,(uint16_t)* Len);
     USBD_CDC_ReceivePacket(hUsbDevice_0);//Getting ready for receiving next data
  return (USBD_OK);
  /* USER CODE END 6 */ 
}

Outcomes