USB CDC CubeMX bug in generated code
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-06 1:31 PM
Posted on February 06, 2016 at 22:31
Hello, in the file usbd_cdc_if.c there is this function:
uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len) { uint8_t result = USBD_OK; /* USER CODE BEGIN 7 */ USBD_CDC_SetTxBuffer(hUsbDevice_0, Buf, Len); while(result != USBD_OK); do { result = USBD_CDC_TransmitPacket(hUsbDevice_0); } while(result != USBD_OK); /* USER CODE END 7 */ return result; } those lines:while(result != USBD_OK);
do {
result = USBD_CDC_TransmitPacket(hUsbDevice_0);
}
while(result != USBD_OK);
don't make many sense and might lead to potential deadlock bcs. the situation is not resolved within timeout.
Happyly the function
USBD_CDC_TransmitPacket
always returns USBD_OK. So in this version it will not lead to deadlock.
Please provide a more professional solution.
Regards, Adib.
#usb-cdc-stm32-cubemx
Labels:
- Labels:
-
STM32CubeMX
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-13 6:49 AM
Posted on April 13, 2016 at 15:49
Also actual problem with lost tx-interrupt.
During high-load transfer I can stay in the ''do{}while;'' cycle infinite time. About load, big packet data for tx (toSTM32 USB endpoint) and short responce to HOST after receive data ST support, can you explain where can I lost interrpt? BR, Denis KrasutskiOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-14 2:20 AM
Posted on April 14, 2016 at 11:20
Hi Denis Krasutski,
usbd_cdc_if.c is a driver for user application, and the code implemented now is just for help so you can modify it or add your own code [in user code section].For more details, on how you use the STM32Cube USb device library, please refer to user manual. Also you can find a full set of running examples within the STM32Cube firmware package (example: STM32Cube_FW_F4_V1.11.0\Projects\STM324x9I_EVAL\Applications\USB_Device\CDC_Standalone)-SyrineOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-24 3:13 AM
Posted on April 24, 2016 at 12:13 Hello Syrine, I know that is code intended to be provided by the user in order to implement the profiles. But this is autogenerated code by CubeMX. Someone configured CubeMx to do so. I showed that this is suspicious dodgy code. Please ST clean up this code. Provide code that has a certain quality standard. Regards, Adib. --
