[PIC] get data from joystick USB

Status
Not open for further replies.

bestrider14

Member level 1
Joined
Feb 27, 2015
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
300
Hi

im new in the world of pic and i need a little help. recently a made a basic USB HID whit my 18f4550 (2led on/off) and now i would like to make a host. I know my 4550 cant make host and I see that some pic24 can do. I try to read about it but am lost. I have MikroC and I get the lib USB HOST. I try to understand the 2 exemple that it give but they are complex and not so commented. My goal is to take data from my xbox 360 controler (usb) and read the value of the stick or button on a LCD. I would like to have some starting point or tutorial or code exemple more basic.

Sorry about my englis im canadian french and i do my best.

Thank you.
 

Do you have the specifications for the input/output of the controller? That is the 1st step!
 

What you want mean ? I know that the controler have 14 output and 0 input. And if i tcheck whith the usb terminal on mikroc i can see some byte scroll.
 

Edit:

I think I found what you mean whit UBSlyser. I can dataloge my data that I whant.

Code:
Device Object	00000079
Driver Object	xusb21

URB Function	URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
URB Status	USBD_STATUS_SUCCESS

Endpoint 81h	1 In, Interrupt

Report Type	Input
Report Length	14

i can see that 14 byte and its change when a press the button on the remote but now i can take these 14 byte in my pic

Code:
Device Object	00000079
Driver Object	xusb21

URB Function	URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
URB Status	USBD_STATUS_SUCCESS

Endpoint 81h	1 In, Interrupt

Report Type	Input
Report Length	14

i hope that what you mean
 

Great! You have some idea as to the data looks like, and what to look for.

Personally I would write the [C] code to read and "display" the data on a PC first. Once you debug the code, then modify it for your target platform.
 

it's true that USB is very difficult for beginners, so i want to ask you a few questions...

- why do you want a gamepad in your project? if it's for generic input I suggest you a simpler shift register like the SNES gamepad or a SPI interface for a Playstation dual shock 2 (you can even get the analog values! and vibrate the controller!!!, but not the PS3 controller, that one is USB-bluetooth and it's harder than your xbox controller)

-how much do you know about microcontrollers and USB? would it suffice a USB to UART-TTL converter?? if yes, I suggest you to look at the vinculum VNC I used one of the modules and configured to send the endpoint data constantly via the UART... so your 14 bytes could get via the USART port...

If you want to learn to make a USB Host, I suggest you to read a lot the USB specification, and the implementation in your compiler (it seems there is a USB Host Library in MikroC for dsPIC, PIC24 and PIC32 so you need at least some knowledge about these new pics...) I finally suggest you to get a HID keyboard example working first... then changing to your gamepad should be breeze...

good luck! you'll need it.
 

Thank you for the reply

My goal in this is to take the data from my controler in my PIC and analyse them to send the info in the NRF24L01. I whant to make a RF controler whit my xbox controler. So yes a Ps2 controler can be an option but i prefere the xbox controler (its my opinion). I will try to make an HID on pc first for practice. And yes a will need luck and patience but i will have it.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…