PDA

View Full Version : 2 Axes USB HID Descriptor problem



TronicBrain
- 5th March 2014, 16:43
Hi everyone,

This is the first time I make usb project with pics but and i read a lot about configuring the Descriptor file.

I just need x and y axes coming from to POTs feeding AN0 and AN1

Windows can recognize my device as joystick but not showing the axes.

I am using PIC18F2550 and there is no extra things the PIC should do

can any one help me in configuring the Descriptor file, my project is in the attachment

Thank you in advance7264

TronicBrain
- 6th March 2014, 13:45
I could go a head one step and everything seems to be well but only on the simulation program, but on realty the two values are always zero and they are not changing while the analog signals change and I also tried to post constant values to find out where the problem is but it think it is from the descriptor file.

I think my Descriptor is still have something wrong so would anyone help me to find what's wrong in my descriptor?

Thank you



ReportDescriptor1
; USAGE_PAGE (Generic Desktop)
retlw 0x05
retlw 0x01
;retlw 0xFF

; USAGE (Joystick)
retlw 0x09
retlw 0x05

; collection(application)
retlw 0xA1
retlw 0x01

;usage (Pointer)
;retlw 0x09
;retlw 0x01

;usage (Phiscal)
;retlw 0xA1
;retlw 0x00



; *** INPUT REPORT ***

; usage(X)
retlw 0x09
retlw 0x33

;usage(Y)
retlw 0x19
retlw 0x34



retlw 0x15 ; logical minimum (-128)
retlw 0x80 ;

retlw 0x25 ; logical maximum (127)
retlw 0x7F


retlw 0x75 ; Report Size (8)
retlw 0x08 ;

retlw 0x95 ; Report count(2)
retlw 0x02 ;


; Input (Data, Variable, Absolute)
retlw 0x81
retlw 0x02

retlw 0xC0 ; end collection


EndReportDescriptor1

Squibcakes
- 18th March 2014, 06:06
TronicBrain did you sort this out yet?

I dug through some of my old examples and found this - not sure if it works but it might get ou in the right direction. I haven't played with pics in a long time so bit rusty.




ReportDescriptor1
RETLW 0x05
RETLW 0x01 ; USAGE_PAGE (Generic Desktop)
RETLW 0x09
RETLW 0x04 ; USAGE (Joystick)
RETLW 0xa1
RETLW 0x01 ; COLLECTION (Application)
RETLW 0x09
RETLW 0x01 ; USAGE (Pointer)
RETLW 0xa1
RETLW 0x00 ; COLLECTION (Physical)
RETLW 0x95
RETLW 0x02 ; REPORT_COUNT (2)
RETLW 0x75
RETLW 0x08 ; REPORT_SIZE (8)
RETLW 0x15
RETLW 0x00 ; LOGICAL_MINIMUM (0)
RETLW 0x26
RETLW 0xff
RETLW 0x00 ; LOGICAL_MAXIMUM (255)
RETLW 0x35
RETLW 0x00 ; PHYSICAL_MINIMUM (0)
RETLW 0x46
RETLW 0xff
RETLW 0x00 ; PHYSICAL_MAXIMUM (255)
RETLW 0x09
RETLW 0x30 ; USAGE (X)
RETLW 0x09
RETLW 0x31 ; USAGE (Y)
RETLW 0x81
RETLW 0x02 ; INPUT (Data Var Abs)
RETLW 0xc0 ; END_COLLECTION
RETLW 0xc0 ; END_COLLECTION
EndReportDescriptor1