А разве Вы теоретически можете прочитать 128 байт ? По-моему, это максимальная длина, включая служебную инфу - там байт 20.
Покажите репорт дескриптор.
У меня, например, под обмен шло 8 байт.
Код: Выделить всё
PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8) -------------- вот они ----------------------
0x95, 0x01, // REPORT_COUNT (1)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
А вот они в файле usbdrv.c
/* --------------------------- Device Descriptor --------------------------- */
#if USB_CFG_DESCR_PROPS_DEVICE == 0
#undef USB_CFG_DESCR_PROPS_DEVICE
#define USB_CFG_DESCR_PROPS_DEVICE sizeof(usbDescriptorDevice)
PROGMEM char usbDescriptorDevice[] = { /* USB device descriptor */
18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
USBDESCR_DEVICE, /* descriptor type */
0x10, 0x01, /* USB version supported */
USB_CFG_DEVICE_CLASS,
USB_CFG_DEVICE_SUBCLASS,
0, /* protocol */
8, /* max packet size */ ------и здесь ---------------------------
и, собственно, сами байты в usbdrv.h
--------------------------------------------
typedef struct usbRequest{
uchar bmRequestType; //1
uchar bRequest; //2
usbWord_t wValue; //3,4
usbWord_t wIndex; //5,6
usbWord_t wLength; //7,8
}usbRequest_t;
---------------------------------------------
Все 8 штук, обращаюсь при чтении и записи
un.dataBuffer - это мой массив обмена
-------------------------------------------------------------
usbMsgLen_t usbFunctionSetup(uchar data[8])
{
usbRequest_t *rq = (void *)data;
if((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_VENDOR){
DBG1(0x50, &rq->bRequest, 1); /* debug output: print our request */ // прием
if(rq->bRequest == CUSTOM_RQ_SET_STATUS)
{
un.dataBuffer[0] = rq->wValue.bytes[0];
un.dataBuffer[1] = rq->wValue.bytes[1];
un.dataBuffer[2] = rq->wIndex.bytes[0];
un.dataBuffer[3] = rq->wIndex.bytes[1];
flag=1;
usbMsgPtr = un.dataBuffer; /* tell the driver which data to return */
return 4;
}else if(rq->bRequest == CUSTOM_RQ_GET_STATUS){
/* buffer must stay valid when usbFunctionSetup returns */
//dataBuffer[0] = ((LED_PORT_OUTPUT & _BV(LED_BIT)) != 0); // передача
// данные в буфере должны быть готовы
un.dataBuffer[0]=0x12;
un.dataBuffer[1]=0x34;
usbMsgPtr = un.dataBuffer; /* tell the driver which data to return */
return 2; /* tell the driver to send 1 byte */
}
}else{
/* calss requests USBRQ_HID_GET_REPORT and USBRQ_HID_SET_REPORT are
* not implemented since we never call them. The operating system
* won't call them either because our descriptor defines no meaning.
*/
}
return 0; /* default for not implemented requests: return no data back to host */
}
Т.е. как бы теоретически большой массив бьется на маленькие пакеты и передается последовательно, но пока с этим не заморачивайтесь, добейтесь обмена полный пакет за 1 раз.