AnsweredAssumed Answered

USB ROM API Custom Device Class

Question asked by Jannik Theiß on Feb 13, 2017
Latest reply on Aug 28, 2017 by Eli Hughes

I'm implementing a USB MIDI device. My in-endpoint works fine but i can't get the out-endpoint to receive data. I registered my endpoint handler with

USBD_API->core->RegisterEpHandler(g_hUsb, 2, epOutHandler, NULL);

As per documentation the handler should receive USB_EVT_OUT events and USB_EVT_OUT_NAK events should be deactivated by default. However my handler is only ever called with USB_EVT_OUT_NAK and never with USB_EVT_OUT.

 

Also, is my approach correct to read the received data with 

USBD_API->hw->ReadEP(hUsb, 0x01, pData);

in my handler whenever it is called with an USB_EVT_OUT event?

 

This is my configuration descriptor in case it matters:

 

ALIGNED(4) uint8_t USB_ConfigDescriptor[] = {
0x09, 0x02, 0x44, 0x00, 0x01, 0x01, 0x00, 0x80, 0x3C,   // Config, 1 interface

 

0x09, 0x04, 0x00, 0x00, 0x02, 0x01, 0x03, 0x00, 0x03,   // Interface0, 2 EPs, Audio, Midi

 

0x07, 0x24, 0x01, 0x00, 0x01, 0x32, 0x00,               // CS Interface (midi)

 

0x06, 0x24, 0x02, 0x01, 0x01, 0x00,                     // jack, in, embed, nr1
0x09, 0x24, 0x03, 0x01, 0x02, 0x01, 0x01, 0x01, 0x00,   // jack, out, embed, nr2

 

0x09, 0x05, 0x01, 0x03, 0x40, 0x00, 0x02, 0x00, 0x00,   // EP, out, nr1, interrupt
0x05, 0x25, 0x01, 0x01, 0x01,                           // CS EP, jack1

 

0x09, 0x05, 0x82, 0x03, 0x40, 0x00, 0x02, 0x00, 0x00,   // EP, in, nr1, interrupt
0x05, 0x25, 0x01, 0x01, 0x02,                           // CS EP, jack2

0x00
};   

Outcomes