2016-02-06 01:31 PM
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
2016-04-13 06:49 AM
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 Krasutski2016-04-14 02:20 AM
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)-Syrine2016-04-24 03:13 AM