USB Composite HID+CDC (VCP) with STM32F401
Hi,
I would like to create a gamepad that is recognized by the computer (windows), and have the Virtual Com Port (CDC) to send en receive data with the computer. For that, I want to create an USB Composite with HID+CDC.
I found an exemple on this website https://www.programmersought.com/article/18127793400/, I followed the guide, correct the warning and error and now my STM32 is recognized ! In device and printer I see the Jubeat Controller, and in device manager I see the serial USB (COMX).
To test both, I simulate button push every 1s for the HID and look the button state in device and printer, and for the VCP I open putty, configure the port com and make an echo of what I write on the keyboard.
My problem is that when I write something on putty, I have an hardfault. The problem was that the buffer receive in static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len) was not the value in RxBuffer but a strange address. I try to correct it by replacing different thing about pdev->... but when I think the problem is gone, the gamepad no more change state in device and printer.
I don't understand how works the USB protocol and I feel I'm really close to resolve my issue.
I can share you my project if you want. In attach, you can find files that I think I must correct/change. I use a Nucleo board with a STM32F401RE. I added a quartz to use the USB.
Thank you for your help !
Edit : you can find my project here https://github.com/Ludovictor/STM32-USB-Composite-HID-CDC
