cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 CubeMX USB CDC does not transmit

transistorboy32
Associate II
Posted on April 27, 2018 at 23:51

  • STM32F407VETx
  • Blank CubeMX project template plus USB_DEVICE middleware using CDC class
  • SW4STM32
  • firmware STM32Cube FW_F4 V1.16.0
  • only modified code from generated templates is this (in main.c):

      /* USER CODE BEGIN 2 */

      char buf[] = {0x01,0x02,0x03,0x04};

      CDC_Transmit_FS(buf, 4);

      /* USER CODE END 2 */
  • Using Beagle USB hardware capture device to monitor USB traffic
  • Host is Linux running Python script using usb.core and usb.util (verified working to read/write similar USB device)
  • Expected result: seeing an IN packet on the USB capture
  • Actual result: no IN packet (NAK was issued when host polled for data)
  • CDC_Transmit_FS returns USBD_OK
  • STM32 device can read data from host application (with additional modified code)
  • Tried: increasing heap to 0x400, adding delays in various places, using different packet/data sizes/lengths
  • CubeMX & project code attached

Any ideas?

1 REPLY 1

Sorry, bumping old zombie unanswered threads off my feed

The F4 library is out at V1.21.0, please try to use something that's at least remotely current.

Check stack and heap allocations. Instrument code for real-time diagnostic output.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..