Page 1 of 1

Completely new to V-USB! Some Questions

Posted: Thu Oct 07, 2010 8:03 pm
by Deadly Arrow
Hi brothers ..
how are you , i hope that you are fine ..

well .. i'm a good C/C++ programmer ... and i have good background of ATMEGA32 Microcontrollers ..
now , i'm trying to move into a new step that by interfacing my microcontroller with a computer ..

when i asked some friends they suggested me to use Parallel or serial ports ..
but i didn't like that for two reasons:
1- i feel it's an old and very traditional way.
2- i want to interface through my laptop , and it doesn't have a serial or parallel port


so i have many questions for you please

1- How can i exactly interface V-USB ?
- i mean , what circuits should i construct to interface ?
2- if my laptop is USB 2.0 does it affect ?
3- If i want to join my interfacing with windows forms in Visual C++ 2010 , can this happen ?
4- Can you just give me a simple code for just controlling some LEDs through USB port , i don't need to understand the underlying protocol .. just i want it as Black Box .. since i will study this in my Computer Organization course in the university
5- does it work well under Windows 7 ? & if not , what platform can run it properly without problems ..?


thank you .. and i would be very happy to answer any of my questions

Regards ..

Re: Completely new to V-USB! Some Questions

Posted: Thu Oct 07, 2010 9:29 pm
by _frank26080115
almost everything you are asking for can be answered by downloading v-usb and looking at the example code and circuit diagrams

USB 2.0 ports are backward compatible with USB 1.1

Take a look at libusb and libusb-win32 to answer your question about winform

It doesn't matter what OS you run

Re: Completely new to V-USB! Some Questions

Posted: Thu Oct 07, 2010 10:33 pm
by Deadly Arrow
Thank you really for your quick reply mr.frank2608011

should i now buy these components and proceed interfacing ?
can i programme my microcontroller directly by USB ? or should i use parallel port programming for the first installation of software ..
i'm know that my questions are somewhat silly ..
be patient with me please : )

Regards

Re: Completely new to V-USB! Some Questions

Posted: Thu Oct 07, 2010 10:47 pm
by _frank26080115
hey if you wait a few days you can get one of these

http://frank.circleofcurrent.com/usnoobie/

take a look around the site, it will go up for sale as a kit soon

Re: Completely new to V-USB! Some Questions

Posted: Thu Oct 07, 2010 11:19 pm
by Deadly Arrow
really thank you mr.franklin ... it's much more clear now ^__^ thanx so much

Re: Completely new to V-USB! Some Questions

Posted: Wed Oct 20, 2010 11:40 am
by jay.elle
_frank26080115 wrote:hey if you wait a few days you can get one of these

http://frank.circleofcurrent.com/usnoobie/

take a look around the site, it will go up for sale as a kit soon



Hey Frank, your website is super cool and i've been looking at your HID tutorial. quick question about your usbFunctionsetup / get report case:

Code: Select all

case USBRQ_HID_GET_REPORT:
         // check for report ID then send back report
         if (rq->wValue.bytes[0] == 1)
         {
            usbMsgPtr = &keyboard_report;
            return sizeof(keyboard_report);
         }
         else if (rq->wValue.bytes[0] == 2)
         {
            usbMsgPtr = &mouse_report;
            return sizeof(mouse_report);
         }
         else if (rq->wValue.bytes[0] == 3)
         {
            usbMsgPtr = &gamepad_report_1;
            return sizeof(gamepad_report_1);
         }
         else if (rq->wValue.bytes[0] == 4)
         {
            usbMsgPtr = &gamepad_report_2;
            return sizeof(gamepad_report_2);
         }
         else
         {
            return 0; // no such report, send nothing
         }


Since your device was built with 4 reports, does the host / standard HID protocol just poll them in a certain way? where did you learn about implementing reports / different types like features?

btw, your business card is awesome!, i'm going to look at that example next... (p.s. - you should enable blogging on your site)
-cheers,

Re: Completely new to V-USB! Some Questions

Posted: Thu Oct 21, 2010 7:21 am
by _frank26080115
From an abstract point of view, the computer does not poll for the reports, but it is allowed to through requests. These requests are handled by usbFunctionSetup. The code itself usually sends out the reports through the interrupt endpoint.

reading this will also help you understand when exactly the data is sent
http://www.beyondlogic.org/usbnutshell/ ... #Interrupt

From a low level point of view, sending a report involves "queueing" the report, and waiting for the computer's poll to grab the next report in the queue. The computer does not specify which report it wants when polling the interrupt endpoint queue, it just grabs the next report in queue.


I learned all this from reading examples and also usb.org's documentations, and http://www.beyondlogic.org/usbnutshell/ helps a lot

thanks for visiting my site, nothing is completely finished and I'll have to update some stuff soon as USnooBie goes on sale.