AnsweredAssumed Answered

STM32L162 USB Device Stack from CubeMX Bugs?

Question asked by Chris_31543 on May 29, 2015

I try to set up a USB-Communication between an STM32L162 Controller and my PC. With the CubeMX-Utility I created a Template for IAR. The first problem that occured was that I use HSE with a 8 MHz Crystal, after Clock-Initialization the device ran into a Fault-Handler. I figured out that even when you set HSE for the PLL-Input instead of HSI the code which is generated uses HSI. After I fixed this the code now is running without any severe faults.

Then I opened a terminal and connected to the Virtual COM port which appeared after startup. For testing the interface I send every 100ms a Test-String from the Controller to the PC, and with a received string i toggle a LED. The direction Controller -> PC is working fine, but the direction PC -> Controller not really. The first time after reset when I send a byte it is ACKed correctly and the LED is toggled. After this byte is received the endpoint STAT_RX register is set to 0x2 (NAK) while processing data. This is not reset to usual 0x3 (ACK) from the USB device stack. Then every byte which is received is NAKed and no interrupt is set on the controller side.

Is this a known problem of the stack or the hardware?

I hope someone will help me soon because this is essential to this project.