AnsweredAssumed Answered

STM32F0 USB CDC Class from CubeMX

Question asked by rusu.mihnea on Feb 18, 2015
Hey all,

I'm trying to implement a USB CDC device on an STM32F072B-Discovery (uses the STM32F072RBT6 device) to simply send some values over to the serial console.

I've not had much luck with this using the code generated by STM32CubeMX. The initialisation is successful and the device correctly enumerates as CDC, however the moment I try to send some data using either CDC_Transmit_FS (inside of usb_cdc_if.c) or the combination of USBD_CDC_SetTxBuffer + USBD_CDC_TransmitPacket (inside of usbd_cdc.c), it neither sends the data nor enumerates as a USB device anymore.

In order to try to isolate this (to me, apparent bug) I've commented out functions one by one and found that when I just call USBD_CDC_TransmitPacket WITHOUT calling USBD_CDC_SetTxBuffer or USBD_CDC_SetRxBuffer a priori, it still enumerates correctly. The problem must therefore be with the Tx/Rx Buffer functions...

I would be very happy if someone could provide some insight into this!

Thanks in advance.