cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a simple sample code for USB

jeff23
Associate II
Posted on November 27, 2015 at 09:34

Hi,

I got the Cube firmware from ST, and I cannot found the USB sample code for test purpose. The current demo codes are complicated, I have to put App, middleware and driver to make the USB work, and it is not good to my user case. What I needed is just a very simple sample code which may act as a mouse, so that I can refer its init and IRQ process. Is there any one who has that source code? BTW, I'm using STM32F439,.

#usb
3 REPLIES 3
Nesrine M_O
Lead II
Posted on November 27, 2015 at 11:27

Hi gu.jeff,

“What I needed is just a very simple sample code which may act as a mouse�?

Have a look to the USB_Device\HID_Standalone example under STM32Cube F4 package, it may be very helpful in your case .In fact it is a typical application on how to use the STM32F4xx USB OTG Device peripheral where the STM32 MCU is enumerated as a HID device using the native PC Host HID driver to which the STM324x9I-EVAL board is connected, in order to emulate the Mouse directions using Joystick buttons mounted on the STM324x9I-EVAL board.

STM32Cube_FW_F4_V1.9.0\Projects\STM324x9I_EVAL\Applications\USB_Device\HID_Standalone

-Syrine-

Posted on November 27, 2015 at 11:54

USB is a relatively complicated protocol, you're not going to find something a simple as you would a USART or LED example, where 20 lines does all the work.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jeff23
Associate II
Posted on November 29, 2015 at 02:08

Syrine,

Thank you so much for your comment. I read that sample code, however, it is really too complicated to my application case. For example, the GPIO init, well, My understanding is that this init can be done in 10lines at most, actually the code exceeds 100line as it is designed for common usage.  What I wanted is an abstract sample code, but not the code with a powerful but sophisticated design.

Jeff