AnsweredAssumed Answered

USB CDC Fatal Error with 9 Byte Receive

Question asked by David Kaplan on May 1, 2017
Latest reply on May 3, 2017 by David Kaplan

I'm running into a Hard Fault when sending 9 bytes from a PC to a STM32F103C8T6 using USB CDC code generated by Cube 4.20.1, FW F1 V1.4.0.  I can send 8 bytes to the microcontroller without issue, but once I try 9 bytes, the micro runs into a Hard Fault.



The project is generated in CubeMX, using System Workbench IDE, and running on a custom board.  The only changes to the generated code is a section that pulls down D+ and waits 500 ms before calling MX_USB_DEVICE_Init().  This allows the PC to de-numerate and renumerate the device.


I'm running RealTerm on my Windows 10 PC, under the "Send" tab, using the data "123456789", and then "Send ASCII".  At this point, the microcontrolller goes to a Hard Fault.  (See attached image for stack trace)  If I send "12345678" instead, everything runs fine.  


I'm not sure how to debug this, so any advice is appreciated.  


Thank you!