changin end point 1 to 2, what did I miss?

10 views
Skip to first unread message

ulao

unread,
Nov 8, 2021, 6:19:04 PM11/8/21
to LUFA Library Support List
Have have a project where I needed to change my endpoint 1 out to a 2 out and now my application is stalling when it tries to write to the device.
the only change I made was
        #define JOYSTICK_EPADDR_IN          (ENDPOINT_DIR_IN | EPNUM1)
        #define JOYSTICK_EPADDR_OUT       (ENDPOINT_DIR_OUT | EPNUM2)
to
        #define JOYSTICK_EPADDR_IN          (ENDPOINT_DIR_IN | EPNUM1)
        #define JOYSTICK_EPADDR_OUT       (ENDPOINT_DIR_OUT | EPNUM1)

and I removed the
Endpoint_SelectEndpoint(EPNUM2);

My application worked fine before this change but I must make this change. Did I miss something?

ulao

unread,
Nov 8, 2021, 6:51:09 PM11/8/21
to LUFA Library Support List
oh, the configure is order dependent.

these were backwards
        Endpoint_ConfigureEndpoint(JOYSTICK_EPADDR_IN,  EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, ENDPOINT_DIR_IN);
        Endpoint_ConfigureEndpoint(JOYSTICK_EPADDR_OUT, EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, ENDPOINT_DIR_OUT);

ulao

unread,
Nov 8, 2021, 6:55:11 PM11/8/21
to LUFA Library Support List
er no wait, that just flipped the condition. So how to I make both work?

ulao

unread,
Nov 9, 2021, 10:56:34 PM11/9/21
to LUFA Library Support List
I'm learning a bit here but still no luck, here is what I learned.

1) HID can only have 3 Endpoints but has a default (0) that can do in and out.
2) my controller payload to the OS should be on Endpoint 1 in
3) pretty sure all ForceFeedback stuff form the PID needs to be on its own Endpoint (i.e. 2)  out but it does work on the default endpoint. I think that is unwise...

I set my device up to match this.
        #define JOYSTICK_EPADDR_IN          (ENDPOINT_DIR_IN | EPNUM1)
        #define JOYSTICK_EPADDR_OUT       (ENDPOINT_DIR_OUT | EPNUM2)

        Endpoint_ConfigureEndpoint(JOYSTICK_EPADDR_IN,  EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1);
        Endpoint_ConfigureEndpoint(JOYSTICK_EPADDR_OUT, EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1);           

and the FFB works, the paddata works, and control transfers will get but not set. I think I need to configure my default out because its not sending data. If I remove the Endpoint 2, then the sets start to work but now the FFB does not. So how do you do this? I tried something like this with no luck.

Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP | ENDPOINT_DIR_OUT, EP_TYPE_CONTROL, 64, 1);

ulao

unread,
Nov 10, 2021, 10:37:20 AM11/10/21
to LUFA Library Support List

disregard the entire thing was a typeo...
APIProcessSets( ReportID ,&ReportData[ReportSize], ReportSize);
vs
APIProcessSets( ReportID ,&ReportData, ReportSize);
Reply all
Reply to author
Forward
0 new messages