1
\$\begingroup\$

The thing I want to do is sending some bytes with STM32F7 discovery to my laptop, through USB (HS or FS). I tested the virtual com example provided by keil microvision so the hardware is OK, but I need to do it using STM32CubeMX. The libraries are different and the best luck I had, was seeing Virtual Com Port in device manager. but Hyperterminal or Putty cannot detect it and there is no sending or receiving data. I have attached my sample code link and clock config, so I appreciate if anyone could help and tell me what the problem is.

My Sample Code

Clock Config

\$\endgroup\$
  • \$\begingroup\$ This isn't a problem that can be easily solved on sites like e.se. I've done a lot of STM32 USB work, and CubeMX has VCP examples you can probably leverage to get yours to work. It is a bit of a tedious process and may take you down into the seedy underbelly of low level USB operation. \$\endgroup\$ – akohlsmith Sep 16 '17 at 18:14
  • \$\begingroup\$ This worked for me: stackoverflow.com/a/33555364/3820025 Make sure to install the STM32 VCP driver correctly (read the comments as well under the answer.) \$\endgroup\$ – Bence Kaulics Sep 16 '17 at 21:30
1
\$\begingroup\$

I finally found the solution. The problem was related to the heap size. I increased the heap size in the startup file from 200 bytes to 400 bytes, so it's working like a charm. But still not the whole problem has been solved. when I use Keil rtx, it stops working. The previous problem appears again. I believe it is about the stack size in rtx config, but with some changes, it's still not working.

Edited: After a lot of challenge it worked out. In this link, it describes some tips about using RTOS-RTX with Stm32CubeMX. One of the things you need to do is setting the priority of SysTick timer in the lowest value. This conflicts with USB interrupts. To use USB-CDC with RTOS-RTX in Stm32CubeMX, you have to set the priority of USB-OTG global interrupt, lower than the SysTick timer. So setting SysTick priority to 14 and USB-OTG to 15 solves the problem.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.