The thing I want to do is sending some bytes with STM32F7 discovery to my laptop, through USB CDC (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.
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.