STM32F4 USB Device Custom HID example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-13 07:22 AM
I am using a custom board with STM32F4 micro and I want to use the Cube libraries. I need a simple example of application of a USB Device configured as Custom HID. I need to know not only how to configure the USB, but also how to transmit data to the PC. On the PC I have a working custom driver software. I really don't know where to start.... Thank you very much.
Solved! Go to Solution.
- Labels:
-
STM32F4 Series
-
UART-USART
-
USB
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-20 12:27 AM
Ok. Solved for now. It was an hardware problem (damaged board). I tried the keyboard and the custom HID example. Now I need to modify an example so I can communicate with my custom driver on PC. My custom board has to work as a customizable keyboard. Is it better to start from the keyboard example or the custom HID example? Any suggestion on which part of the code I need to modify? Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-13 09:19 AM
Hello VCapu,
If you are not sure where to start I would like to direct you to STM32 USB training. In the video material there is covered many topics on USB for and the lab are done on STM32F4 MCU. There are also included some examples on HID devices. Some other examples are also available in STM32CubeF4 software package. You were saying you were using custom board, if you will run in to some hardware related problem I would also consider to check this document AN4879. Let me know if you have any further questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-14 03:07 AM
Thank you for the advice. I followed step by step the example "USB Custom HID Device lab", but when I connect the board to the PC it is detected as "Unkonwn Device" and if I try to open the HID terminal, it is shown the message "Failed to open device". Any suggestion? I am stuck on this part of my project...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-14 09:17 AM
I will gladly try to help you, but I will need more information from you about your HW setup. For start what MCU are you using and are you using embedded pull-up or external one? Also how do you clock your USB peripheral? Are you using external high speed oscillator? If you are using MCU for which there will be ready to use example within the STM32CubeF4 FW package I would maybe recommend to try this example so you exclude HW related problems. I will wait for your answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-16 11:55 PM
Hello Petr. The MCU is STM32F405ZGT6. In the GPIO settings on Cube I selected no pull up and no pull down. This is the clock configuration.In the STM32CubeF4 package there are no examples for boards with the same MCU. What could be the most similar to the one that I am using?
In this phase, I need only to see that USB communication is working, and then understand how to modify an example to adjust it for my application. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-17 06:16 AM
Hello VCapu,
according to RM0090, STM32F405xx/07xx and STM32F415xx/17xx all should be really similar together and from this reason I would go for examples in folder STM324xG_EVAL. There is also code for custom hid example. Do I understand it correctly that you have external pull-up resistor at the D+ line and external oscillator on your custom board?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-18 03:18 AM
No, there is not external pull_up. I tried to set the internal pull-up but nothing changed. I use external oscillator.
I will try to check that example. I need to make some modifications? Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 12:03 AM
I tried also to use external pull-up on both USB lines or only on D+ but nothing changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-19 05:55 AM
Do you have any suggestions? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-20 12:27 AM
Ok. Solved for now. It was an hardware problem (damaged board). I tried the keyboard and the custom HID example. Now I need to modify an example so I can communicate with my custom driver on PC. My custom board has to work as a customizable keyboard. Is it better to start from the keyboard example or the custom HID example? Any suggestion on which part of the code I need to modify? Thank you