Basic USB example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Basic USB example

1,801 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ajay on Sat Apr 02 12:37:58 MST 2011
I have zero knowledge about the USB protocol. So I am not sure how best to describe this request:

I would like to be able to pass A/D readings from the LPCxpresso base board to the PC.

What is a good starting point?

Thanks in advance.

Ajay
0 Kudos
Reply
9 Replies

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ajay on Mon Apr 04 10:57:12 MST 2011
Thanks very much for the pointers.  Looks like I have some work to do...
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sjalloq on Mon Apr 04 07:10:20 MST 2011
That PDF link above is a good starting place and once you understand the different USB transfer mechanisms you'll be better placed to know what is appropriate for your application.

For example, you could write something as simple as a vendor specific control request that reads your ADC value whenever it is polled.  I think this would also involve the least amount of programming on the host side too.

Take a look at any of the HID examples and think about whether they would work for you.  A keyboard, for example, works by having the host regularly poll the device for key presses.  You could replace the key press data with your ADC readings - obviously creating your own HID report type and writing the host software to handle it.

Start with the basics of USB such as the different stages and packet types, then move onto Control transfers, then try to get your head around how something as simple as a HID device works.  Then worry about your app.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ajay on Mon Apr 04 04:16:12 MST 2011
Since I do not know the basics (things like the difference between Host, Device, OTG), I will need to learn more.  I was hoping for some guidance on which example is best suited for my project:  Ability to read A\D counts and send to PC via USB.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sjalloq on Mon Apr 04 04:05:54 MST 2011
No example in mind.  You just need to pick one and ask your next round of questions.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ajay on Sun Apr 03 19:25:15 MST 2011
Yes, I know.  I have looked through them time to time.  But was wondering if 'sjalloq' had a specific one in mind.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sun Apr 03 18:09:49 MST 2011
Ajay the  RDB1768 examples work fine with the LPCXpresso 1769 board.   They should give you an idea as to where to start.  I've used them as a base for my own USB code on the LPCXpresso 1769 board with just a USB connector wired up.  You may have to modify them a little to work with the base board.

Fernando thanks for the link to the tutorial.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Fernando on Sun Apr 03 17:29:16 MST 2011
You can check this tutorial:

http://www.beyondlogic.org/usbnutshell/usb-in-a-nutshell.pdf

I think it´s the best introduction to the USB bus. Very easy to read.

Fernando
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ajay on Sun Apr 03 08:26:32 MST 2011

Quote: sjalloq
Easiest way is to look for a HID class example and modify that. You can use the HID Report structure to send your ADC samples back to the host. You should find lots of software examples for both device and host.



Thanks very much as that provides direction.  I will order the book as it would be good to have.  The abundance of examples is overwhelming.  What is the name of a project which contains the HID class?  There are many projects:  projects which come with the IDE, Keil examples for MCB1700, RDB1768 examples, ets.  I have an LPCXpresso 1769 board. Many thanks.
0 Kudos
Reply

1,783 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sjalloq on Sun Apr 03 06:01:29 MST 2011
Easiest way is to look for a HID class example and modify that.  You can use the HID Report structure to send your ADC samples back to the host. You should find lots of software examples for both device and host.

I have a USB book that is brilliant. USB Complete, Fourth Edition, Jan Axelson.  Good starting point if you know nothing but remember the USB specs are freely available and aren't that hard to read.

Cheers.
0 Kudos
Reply