2015-11-19 03:21 AM
Hi, I have generated a basic project with STM32Cube. the 1st step is to make USB working as COM Port. I have made some tests and the communication from STM32 and PC is working I can send data, but if I try to send some bytes from PC to STM32 the device make a rest and windows say device not recognized. The code I have used is the basic generated by STM32Cube, no custom code (only for sending byte is custom) why as is the generated code doesn't work? I have attached some screenshots of STM32Cube. Also why if I attach the device the PC recognize two serial ports, one working (COM7) one not working (COM6)?
Best regardsGian #usb #cdc #cdc #stm32l1 #stm32cube2015-11-19 09:04 AM
Solved, the solution for everyone and a suggestion to STM32Cube team
Original function:int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
return (USBD_OK);
/* USER CODE END 6 */
}
Modified function
int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
/* USER CODE END 6 */
}
without USBD_CDC_ReceivePacket(&hUsbDeviceFS);
after fiew bytes all is crashing
2015-12-02 07:09 PM
Hello Gian,
I have same problem with you. After I do the solution , it's not work.I am using STM32L151CBT6 , my custom board. The USB CDC was worked with example of STM32_USB-FS-Device_Lib_V3.4.0.Do you modify other code after CUBE generated ?RegardsYeap2015-12-03 05:47 AM
Hi wu.yeap,
Is your device successfully enumerated? If no, try to increase heap and stack sizes.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.