cancel
Showing results for 
Search instead for 
Did you mean: 

B-L475e-IOT Board USB CDC not working / recognized

MBurh.1
Associate

Dear all,

I am struggling with the B-L475e-IOT board and USB. If I use the default initialisation of CubeMX and change the USB device to OTG FS Device only and add the Middleware of the Communication device class I can not get this as recognized device on Win 7 as well as Win 10.

The line coding is set within usbd_cdc_if.c as in the USB mooc as follows in CDC_Control_FS and Linecoding is defined and initialized as follows:

USBD_CDC_LineCodingTypeDef Linecoding = {
115200, /*baudrate*/
0x00, /*stop bits-1*/
0x00, /*parity none*/
0x08, /*no of bits*/};

    case CDC_SET_LINE_CODING:
    	Linecoding.bitrate = (uint32_t)(pbuf[0] | pbuf[1] << 8 |\
    							pbuf[2] << 16 | pbuf[3] << 24);
    	Linecoding.format = pbuf[4];
    	Linecoding.paritytype = pbuf[5];
    	Linecoding.datatype = pbuf[6];
 
    break;
 
    case CDC_GET_LINE_CODING:
 
		pbuf[0] = (uint8_t)(Linecoding.bitrate);
		pbuf[1] = (uint8_t)(Linecoding.bitrate>>8);
		pbuf[2] = (uint8_t)(Linecoding.bitrate>>16);
		pbuf[3] = (uint8_t)(Linecoding.bitrate>>24);
		pbuf[4] = Linecoding.format;
		pbuf[5] = Linecoding.paritytype;
		pbuf[6] = Linecoding.datatype;
 
		break;

Using other STMs I got it working the same way. Is there any obvious thing which I do not see for now? With the other controllers I can even see them in device manager as Com Port right after the execution of MX_USB_DEVICE_Init(). Here I only get an unknown device.

Hopefully someone sees what the issue is, thanks in advance,

Marcel

1 ACCEPTED SOLUTION

Accepted Solutions
MBurh.1
Associate

Dear all, I found the solution. Obviously the USB clock was not stable enough by the default configuration in CubeMX for this board. Changing the USB-Clock source to MSI oscillator at 48MHz instead of HSI PLL and it worked instant.

I did not see this issue as for most Nucleo or Discovery the STLink provides a stable 8 MHz clock for the HSE.

View solution in original post

1 REPLY 1
MBurh.1
Associate

Dear all, I found the solution. Obviously the USB clock was not stable enough by the default configuration in CubeMX for this board. Changing the USB-Clock source to MSI oscillator at 48MHz instead of HSI PLL and it worked instant.

I did not see this issue as for most Nucleo or Discovery the STLink provides a stable 8 MHz clock for the HSE.