2014-05-19 06:18 AM
Hello all,
I'm searching about example for USB dialog with USB OTG connector. I don't understand what are difference between HID, CDC & MSC ? My project is dialog with a usb device which only response to me. Please have you example, because all i found on WWW is uncomplete. I'm working with CoIDE. Big Thanks2014-05-19 06:44 AM
''I don't understand what are difference between HID, CDC & MSC ?''
First understand that USB is divided into Host and Device : USB Host eg PC USB Device eg Mouse, Memory Stick ''HID, CDC & MSC'' These are all USB Devices : HID = Human Interface Device - eg mouse, keyboard or joystick CDC = Communications Device Class - eg RS232 to USB adapter, Modem, Network adapter MSC = Mass Storage Device - eg USB memory stick ST have provided examples of all 3 in their library (driver) for UST OTG http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF257882 Unless you have the specific Evaluation board that they have written are for, you will have to modify the demo(s) for your hardware. ''My project is dialog with a usb device which only response to me.'' Unfortunately, unless you pay for your own VID (vendor Identifier) and PID (product idenifier) this is not possible. You will have to use the demonstration PID/VIDs2014-05-20 02:20 AM
Ok,
I need Device USB HID. I downloaded library you say, but i don't see how send & received data !!! In examples, it's always light led but never dialog with device :( I'm working with stm32F4 discovery board. I detect correctly the device connection but after i'm stoped ... My device send his configuration, but i don't know which API used to read it.2014-05-20 02:51 AM
''I need Device USB HID.
I'm working with stm32F4 discovery board.'' OK, it becomes a little easier. Download this : http://www.st.com/web/en/catalog/tools/PF257904# Build and load the example in 'stsw-stm32068.zip\STM32F4-Discovery_FW_V1.1.0\Project\Demonstration' This has a simple HID. It uses the MEMS (accelerometers) on the eval board to simulate a USB HID mouse. Study the example. Work out how the MEMS data is transfered into the USB HID driver. (Hint look at USBD_HID_GetPos() and USBD_HID_SendReport() )2014-05-20 06:40 AM
Thanks for your answer,
but i don't understand. There is always function/file not present. I tried with Cube but generated code is also different library (hal ...) and i don't know enable irq with that.2014-05-20 07:02 AM
''I'm working with CoIDE.''
''Thanks for your answer, but i don't understand. There is always function/file not present.'' I am afraid your IDE is the problem. The examples ST provide all work for IAR Atollic Keil You can download a free version of IAR (code size limited): http://www.iar.com/Service-Center/Downloads/ I do not know if the demo project will work (fits in the limited code size)2014-05-20 09:40 AM
I try again,
because my project is very advanced, GPS implemented, fatfs SDCARD implemented... Stay just my USB device ... Thanks2014-05-21 12:35 AM
I use this code : http://mikrocontroller.bplaced.net/wordpress/?page_id=1993
In main,while
(1)
{
// Test ob USB-Verbindung zum PC besteht
if
(UB_USB_HID_GetStatus()==USB_HID_CONNECTED) {
// Ceck ob Daten per USB empfangen wurden
check=UB_USB_HID_ReceiveData(buf);
if
(check==RX_READY) {
// wenn Daten empfangen wurden
// als Echo wieder zurücksenden
UB_USB_HID_SendData(buf,HID_OUT_BUFFER_SIZE);
}
}
UB_USB_HID_GetStatus()
send
USB_HID_CONNECTED
only 1 time !!!
after it send
USB_HID_Detached ??????
2014-05-21 02:57 AM
''I use this code : http://mikrocontroller.bplaced.net/wordpress/?page_id=1993'';
''UB_USB_HID_GetStatus()
send
USB_HID_CONNECTED
only 1 time !!!
after it send
USB_HID_Detached ??????
''
I am unfamiliar with this code and do not have the time to debug it for you/them.
I know the code in
http://www.st.com/web/en/catalog/tools/PF257904#
'stsw-stm32zip\STM32F4-Discovery_FW_V1.1.0\Project\Demonstration'
works. I have personally tried it here with Atollic.
Start with this example and start tinkering with it to understand it. That is the best I can do with my limited time.