cancel
Showing results for 
Search instead for 
Did you mean: 

Bug: CDC_Control_FS() in usbd_cdc_if.c is empty

infor
Associate III
Posted on May 25, 2017 at 22:17

I've experienced random and unexplainable problems with CDC communication over USB, while using CubeMX-generated code.

The PC was always able to enumerate the COM port, but sometimes it was unable to open it, (Windows reports a ''wrong parameter'' error).

After a thorough research and the use of an USB sniffer, I think I've identified the problem.

The issue comes from a wrong answer to the PC's request GET_CODING_LINE.

When the PC issues this request, it expects a payload containing line speed in bps, parity, stop bits and databits.

CDC_Control_FS() in usbd_cdc_if.c should fill the payload with correct data, but in facts its body is empty. There a switch listing the various CDC messages, but the case statements do nothing.

case CDC_SET_LINE_CODING:

    break;

  case CDC_GET_LINE_CODING:

    break;

(...and so on...)

For this reason, the payload contains random data that, in most cases, prevent the communication to work.

Here is an example of a request that the sniffer captured.

0690X00000606zFQAQ.png

The body of the function is classified as ''user code'', but leaving it empty is misleading.

I wasted a lot of time to track down this problem.

I understand that CDC code is provided as an example, yet there is not even a simple &sharpwarning to help developers avoiding this pitfall.

I think this should be fixed as soon as possible.

#usb-cdc #cube-mx
2 REPLIES 2
Imen.D
ST Employee
Posted on May 26, 2017 at 10:57

Hi

Scarpi.Giuseppe.002

,

Thank you for your reported issue and your feedback.

Which STM32CubeMX version you are using ?

Iwill forward this issue internally to CubeMx team. S

o, could you pleaseattach your ioc file, it would be very helpful to try to reproduce the same behaviour.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 27, 2017 at 11:23

Hello Imen, I am using the lastest MXCube.

I upgrade the software 2 days ago.

Giuseppe