STM32G431RB cannot start USB CDC, PC cannot detect the device(unknown device error)
Hi,
I got a problem with running USB CDC on STM32G431RB. I configured USB as device and added USB CDC driver.
I have changed 'CDC_Control_FS' function in 'usbd_cdc_if.c' file.
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;
break;I tried on both Windows 10 and Windows 7 PC but I get all the time error: 'Unknown device'(looks like vendor id is never delivered to PC, but I checked and stm32 tries to send it).
I also tried both crystalless version and using HSE.
Does anyone got it working on STM32G4?
EDIT: One more thing I checked USB bootloader and it works, so the problem is software I believe.
Thanks.