cancel
Showing results for 
Search instead for 
Did you mean: 

cubeMX stm32f042 custom HID USB problem

fei harrison
Associate
Posted on December 23, 2016 at 03:36

Hello everyone! I use CubeMX to generate projects for stm32f042f6 USB custom HID mode,  when I configured parameters ,download to my circuit board,connect it to PC,but the USB HID Demonstrator do not display any message;

Configuration is as follows:

0690X00000605tgQAA.png0690X00000605vzQAA.png0690X00000605wTQAQ.png0690X00000605wYQAQ.png0690X00000605rZQAQ.png

I wonder if the stm32f042 can realize this function of custom HID mode?

Thank you for your answer to my question first?

#cubemx-stm32f042-custom-hid
5 REPLIES 5
Kraal
Senior III
Posted on December 23, 2016 at 10:43

Hi !

I've done a custom hid device with the same uC as you, the STM32F042F6. So I can tell you that it is possible. Even if I didn't use CubeMX, but rather the SPL version of the USB lib for F0x2.

One thing I don't understand from your pictures is the clock tree configuration. You seem to have a crystal connected (from the GPIO view), why don't you use it as a clock source for the USB ? The USB needs a precise clock, so a crystal would be better than HSI. But you can also choose HSI48 as a clock source for the USB (and for the system if you like) and use the SOF event to recalibrate automatically the HSI48 at run time (this is what I did and it worked). Maybe the clock instability is why the device is showing with an exclamation mark on its icon. Can you tell us what is the error/warning message related to your device (right-click->properties) ?

Posted on December 24, 2016 at 02:32

Thank you for your answer to my question!

After the USB device to connect the computer shows that the equipment cannot be started, the error code 10.What does this error mean?

0690X00000605y0QAA.png

When I try to use HSE will lead to my USB device shows unable to connect, so I just choose HSI.After listening to your advice, I will check for HSE issues first !

Thanks a lot!!

Posted on December 25, 2016 at 07:58

You must increase size of stack & heap

Posted on December 25, 2016 at 14:55

?@chernobay.vitaliy:  By how much?  What would be reasonable values to use for the stack & heap sizes?  I have run into the same problem as Fei.

Thanks (Ñ��?¿�?°Ñ��?¸�?±�?¾),

Dale

Posted on December 25, 2016 at 15:25

pick experimentally

1000-4000