AnsweredAssumed Answered

How to set or get Feature Reports

Question asked by john coppola on Apr 13, 2020
Latest reply on Apr 26, 2020 by Jing Pan

I am developing USB device firmware using the EVK MIMXRT1060 development board and the NXP USB middleware (MCUXpresso SDK USB Stack Device).

 

Below is a generic/custom HID descriptor I have created for my USB device. 

 

The INPUT, OUTPUT report types work fine. However, I am unable to send or receive the FEATURE Report type.

As I understand it feature reports are sent via Endpoint 0 as control configuration data. But it is not clear what API functions I am supposed to use and/or in which events? 

 

I can find no sample code for get/set feature reports or perhaps I am not looking properly. What am I missing?

 

USB_DMA_INIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE)
uint8_t g_UsbDeviceHidGenericReportDescriptor[] = {
0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
0x09, 0x01, // Usage (0x01)
0xA1, 0x01, // Collection (Application)

0x85, 0x01, // Report ID (1) SUCCESS/FAIL - Total size 2B
0x09, 0x00, // Usage (0x00) we dont use usage
0x75, 0x08, // Report Size (8 bits) success/fail/ack/nak/errorcode/etc...
0x95, 0x01, // Report Count (1)
0x81, 0x03, // Input (Data,Var,Abs)

0x85, 0x02, // Report ID (2) General Request - Total size 34B
0x09, 0x00, // Usage (0x00) we dont use usage
0x75, 0x08, // Report Size (8) command (tag)
0x95, 0x01, // Report Count (1)
0x91, 0x03, // Output (Data,Var,Abs)
0x75, 0x08, // Report Size (8 bits)
0x95, 0x20, // Report Count (32)
0x91, 0x03, // Output (Data,Var,Abs)

0x85, 0x03, // Report ID (3) General Response - Total Size 66B
0x09, 0x00, // Usage (0x00) we dont use usage
0x75, 0x08, // Report Size (8) command (tag)
0x95, 0x01, // Report Count (1)
0x81, 0x03, // Input (Data,Var,Abs)
0x75, 0x08, // Report Size (8 bits) Response data
0x95, 0x40, // Report Count (64)
0x81, 0x03, // Input (Data,Var,Abs)

0x85, 0x04, // Report ID (4) Flash a data page - Total size 261B
0x09, 0x00, // Usage (0x00) we dont use usage
0x75, 0x20, // Report Size (32 bits) address at which to burn
0x95, 0x01, // Report Count (1) 4B address - 32bit word
0x91, 0x03, // Output (Data,Var,Abs)
0x75, 0x08, // Report Size (8 bits)
0x96, 0x00, 0x01, // Report Count (256) 256B of data to be burned to flash
0x91, 0x03, // Output (Data,Var,Abs)

 

// How to transmit/receive this report?

0x85, 0x05, // Report ID (5) SUCCESS/FAIL - Total size 2B
0x09, 0x00, // Usage (0x00) we dont use usage
0x75, 0x08, // Report Size (8 bits)
0x95, 0x08, // Report Count (1)
0xB1, 0x02, // Feature (Data,Var,Abs)

 

0xC0, // End Collection
};

Outcomes