2010-08-26 04:03 AM
USB simple Example
2011-05-17 05:04 AM
k...but give me the hint atleast how to start .....this is the fist time i am using and studying controller with USB..I dont have any idea...
2011-05-17 05:04 AM
I haven't found one yet, nor have I worked it out myself. I am 90% there but the examples are too specific and the documentation rubbish.
I wish they would just make a simple complete example of a read/write pipe for everybody to use!
2011-05-17 05:04 AM
I started with the joystick HID demo... then decided I didn't want HID so went on to create my own descriptors and a .inf file for a WinUSB driver (look it up on msdn). Then some VC++ code to talk and I am now getting close with the embedded code. I will admit, the hardest part for me has been the USB FS library!
What do you want your device to do?
2011-05-17 05:04 AM
i use Keil IDE,i am not able to understand USB FS library!and as i am starter i just want to write simple code to configure USb to transmit/receive data from/to to the PC. i tried like this to write the reg like this USB->CNTR=0X00000001; but it gives error like this identifier USB is undefined. how to configure the registers.
2011-05-17 05:04 AM
Getting USB talking to a PC is very difficult. Probably one of the most trickiest peripherals to use. There are heaps of registers to set up and USB will not talk without some sort of communications stack working. I would strongly recommend using the ST FS library particularly if you are a beginner. There is a lot of work getting USB working letalone tring to write the USB stack too. There are other IDEs you can use but I see no reason why you cant use the ST USB stack in the Keil IDE. To get USB you need to do the following:
2011-05-17 05:04 AM
''I wish they would just make a simple complete example...''
The fundamental problem with that, as you now seem to have found, is that USB isnot
simple!''Have you considered using the UART to talk to the PC?'' That is certainly a lot simpler from the microcontroller's perspective - although some people do still seem to manage to make heavy weather of working with a UART! Maybe the ''simplest'' (sic?) approach would be to use one of the UART-to-USB adaptors from the likes of FTDI - espeicially if your PC (as is common today) doesn't have any real COM ports! FTDI do cables which connect direct to the microcontroller's UART (3V or 5V logic levels) at one end, and plug into the PC's USB socket at the other. No special drivers are required, and it appears as a standard COM port to the PC applications:2011-05-17 05:04 AM
''can I run HID demo in my board''
That, of course, depends on whether or no you have correctly designed your board for that purpose! Since you have given no details of your board design, it is impossible to say!2011-05-17 05:04 AM
i downloaded STM32_USB-FS-Device_Lib_V3.2.1 we have designed our own board using STM32F103R8T6 can I run HID demo in my board
2011-05-17 05:04 AM
''
I run HID demo in my board''
Why not? It just uses that state of a few port pins for input or output. The joystick demo is an even simpler example. I got it working on the wrong type of development kit. Just had to alter clock settings to suite my board and swap a few port pins round...