Портал для радиолюбителей и разработчиков электроники · с 2003 годаРеклама на сайте
Найти компонент, схему или даташит

Даташиты, справочник отечественных приборов, схемы с разбором и живой форум


 
Опции темы

STM32F4 USB HID составление репорта

Непрочитано 29.11.2013, 13:50  
swat24
Гражданин KAZUS.RUN
 
Регистрация: 16.03.2009
Адрес: Украина, Харьков
Сообщений: 762
Сказал спасибо: 108
Сказали Спасибо 67 раз(а) в 67 сообщении(ях)
swat24 на пути к лучшему
По умолчанию STM32F4 USB HID составление репорта

Добрый день. Никто не писал прошивку для приема/передачи через USB HID устройством 64 байт (можно больше) ?
Как сделать репорт? В примерах только репорт мыши... Нашел какой-то пример, но там отправляется только 2 байта ( 1 байт - название отправки, второй - данные). В документацию к ЮСБ пытался вникнуть - пока ничего не получилось.
Сегодня нашел настройку юсб из микропаскаля, выглядит она следующим образом:
Код:
type device_descriptor = record
    bLength : char;               // bLength         - Descriptor size in bytes (12h)
    bDescriptorType : char;       // bDescriptorType - The constant DEVICE (01h)
    bcdUSB : word;                // bcdUSB          - USB specification release number (BCD)
    bDeviceClass : char;          // bDeviceClass    - Class Code
    bDeviceSubClass : char;       // bDeviceSubClass - Subclass code
    bDeviceProtocol : char;       // bDeviceProtocol - Protocol code
    bMaxPacketSize0 : char;       // bMaxPacketSize0 - Maximum packet size for endpoint 0
    idVendor : word;              // idVendor        - Vendor ID
    idProduct : word;             // idProduct       - Product ID
    bcdDevice : word;             // bcdDevice       - Device release number (BCD)
    iManufacturer : char;         // iManufacturer   - Index of string descriptor for the manufacturer
    iProduct : char;              // iProduct        - Index of string descriptor for the product.
    iSerialNumber : char;         // iSerialNumber   - Index of string descriptor for the serial number.
    bNumConfigurations : char;    // bNumConfigurations - Number of possible configurations
end;

const device_dsc : device_descriptor = (
  0x12,                   // bLength
  0x01,                   // bDescriptorType
  0x0200,                 // bcdUSB
  0x00,                   // bDeviceClass
  0x00,                   // bDeviceSubClass
  0x00,                   // bDeviceProtocol
  8,                      // bMaxPacketSize0
  USB_VENDOR_ID,          // idVendor
  USB_PRODUCT_ID,         // idProduct
  0x0001,                 // bcdDevice
  0x01,                   // iManufacturer
  0x02,                   // iProduct
  0x00,                   // iSerialNumber
  0x01                    // bNumConfigurations
);

// Configuration 1 Descriptor
const configDescriptor1 : array[41] of byte = (
    // Configuration Descriptor
    0x09,                   // bLength             - Descriptor size in bytes
    0x02,                   // bDescriptorType     - The constant CONFIGURATION (02h)
    0x29,0x00,              // wTotalLength        - The number of bytes in the configuration descriptor and all of its subordinate descriptors
    1,                      // bNumInterfaces      - Number of interfaces in the configuration
    1,                      // bConfigurationValue - Identifier for Set Configuration and Get Configuration requests
    0,                      // iConfiguration      - Index of string descriptor for the configuration
    USB_SELF_POWER,         // bmAttributes        - Self/bus power and remote wakeup settings
    USB_MAX_POWER,          // bMaxPower           - Bus power required in units of 2 mA

    // Interface Descriptor
    0x09,                   // bLength - Descriptor size in bytes (09h)
    0x04,                   // bDescriptorType - The constant Interface (04h)
    0,                      // bInterfaceNumber - Number identifying this interface
    0,                      // bAlternateSetting - A number that identifies a descriptor with alternate settings for this bInterfaceNumber.
    2,                      // bNumEndpoint - Number of endpoints supported not counting endpoint zero
    0x03,                   // bInterfaceClass - Class code
    0,                      // bInterfaceSubclass - Subclass code
    0,                      // bInterfaceProtocol - Protocol code
    0,                      // iInterface - Interface string index

    // HID Class-Specific Descriptor
    0x09,                   // bLength         - Descriptor size in bytes.
    0x21,                   // bDescriptorType - This descriptor's type: 21h to indicate the HID class.
    0x01,0x01,              // bcdHID          - HID specification release number (BCD).
    0x00,                   // bCountryCode    - Numeric expression identifying the country for localized hardware (BCD) or 00h.
    1,                      // bNumDescriptors - Number of subordinate report and physical descriptors.
    0x22,                   // bDescriptorType - The type of a class-specific descriptor that follows
    USB_HID_RPT_SIZE,0x00,  // wDescriptorLength - Total length of the descriptor identified above.

    // Endpoint Descriptor
    0x07,                   // bLength - Descriptor size in bytes (07h)
    0x05,                   // bDescriptorType - The constant Endpoint (05h)
    USB_HID_EP or 0x80,     // bEndpointAddress - Endpoint number and direction
    USB_TRANSFER_TYPE,      // bmAttributes - Transfer type and supplementary information
    0x40,0x00,              // wMaxPacketSize - Maximum packet size supported
    EP_IN_INTERVAL,         // bInterval - Service interval or NAK rate

    // Endpoint Descriptor
    0x07,                   // bLength - Descriptor size in bytes (07h)
    0x05,                   // bDescriptorType - The constant Endpoint (05h)
    USB_HID_EP,             // bEndpointAddress - Endpoint number and direction
    USB_TRANSFER_TYPE,      // bmAttributes - Transfer type and supplementary information
    0x40,0x00,              // wMaxPacketSize - Maximum packet size supported
    EP_OUT_INTERVAL         // bInterval - Service interval or NAK rate
);

type hid_report_descriptor = record
  report : array[USB_HID_RPT_SIZE] of char;
end;

const hid_rpt_desc : hid_report_descriptor = (
  (0x06, 0x00, 0xFF,      // Usage Page = 0xFF00 (Vendor Defined Page 1)
  0x09, 0x01,             // Usage (Vendor Usage 1)
  0xA1, 0x01,             // Collection (Application)
  // Input report
  0x19, 0x01,             // Usage Minimum
  0x29, 0x40,             // Usage Maximum
  0x15, 0x00,             // Logical Minimum (data bytes in the report may have minimum value = 0x00)
  0x26, 0xFF, 0x00,       // Logical Maximum (data bytes in the report may have maximum value = 0x00FF = unsigned 255)
  0x75, 0x08,             // Report Size: 8-bit field size
  0x95, HID_INPUT_REPORT_BYTES,// Report Count
  0x81, 0x02,             // Input (Data, Array, Abs)
  // Output report
  0x19, 0x01,             // Usage Minimum
  0x29, 0x40,             // Usage Maximum
  0x75, 0x08,             // Report Size: 8-bit field size
  0x95, HID_OUTPUT_REPORT_BYTES,// Report Count
  0x91, 0x02,             // Output (Data, Array, Abs)
  0xC0)                   // End Collection
  );
На пике отправлялось/принималось 64 байта. Сейчас переписал это все на СТМ32 и устройство видится перестало вообще...
Реклама:
swat24 вне форума  
Непрочитано 29.11.2013, 14:36  
Hives
Гражданин KAZUS.RUN
 
Регистрация: 25.11.2010
Сообщений: 516
Сказал спасибо: 1
Сказали Спасибо 126 раз(а) в 109 сообщении(ях)
Hives на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

Код:
/* Report descriptors */
const uint8_t ReportDescriptor[SIZE_REPORT_DESC] =
{
  0x05, 0x40,                           // USAGE_PAGE (Instruments)
  0x09, 0x00,                           // USAGE (Undefined)
  0xA1, 0x00,                           // COLLECTION (Vendor Defined)

  0x75, 0x08,                           // REPORT_SIZE (8 bits)
  0x95, 0x30,                           // REPORT_COUNT (48 bytes)
  0x09, 0x00,                           // USAGE (0)
  0x81, 0x00,                           // INPUT (Data,Var,Abs)

  0x75, 0x08,                           // REPORT_SIZE (8 bits)
  0x95, 0x10,                           // REPORT_COUNT (16 bytes)
  0x09, 0x00,                           // USAGE (0)
  0x91, 0x00,                           // OUTPUT (Data,Var,Abs)

  0xC0                                  // END_COLLECTION
};
рабочее. размер моих репортов (48/16) правишь под себя.

Последний раз редактировалось Hives; 29.11.2013 в 14:38.
Hives вне форума  
Сказали "Спасибо" Hives
swat24 (29.11.2013)
Непрочитано 29.11.2013, 14:50  
swat24
Гражданин KAZUS.RUN
 
Регистрация: 16.03.2009
Адрес: Украина, Харьков
Сообщений: 762
Сказал спасибо: 108
Сказали Спасибо 67 раз(а) в 67 сообщении(ях)
swat24 на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

Это только ReportDescriptor, а во всех остальных (USBD_DeviceDesc,USBD_DeviceQualifierDesc,USBD_HID _CfgDesc,USBD_HID_Desc) что менять? пробовал вставлять куски из рабочего примера - устройство пропало вообще...

Очень не хочется использовать UART с переходником, т.к. предполагается использовать комп без мыши и клавиатуры, а вдруг изменится номер ком порта, его выбрать уже не смогут. та и скорость у юсб побольше будет...

Сейчас настроено следующее:
Код:
__ALIGN_BEGIN uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END =
{
  USB_LEN_DEV_QUALIFIER_DESC,
  USB_DESC_TYPE_DEVICE_QUALIFIER,
  0x00,
  0x02,
  0x00,
  0x00,
  0x00,
  0x40,
  0x01,
  0x00,
};
Код:
__ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END =
{
  0x09, /* bLength: Configuration Descriptor size */
  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
  USB_HID_CONFIG_DESC_SIZ,
  /* wTotalLength: Bytes returned */
  0x00,
  0x01,         /*bNumInterfaces: 1 interface*/
  0x01,         /*bConfigurationValue: Configuration value*/
  0x00,         /*iConfiguration: Index of string descriptor describing
  the configuration*/
  0xE0,         /*bmAttributes: bus powered and Support Remote Wake-up */
  0x32,         /*MaxPower 100 mA: this current is used for detecting Vbus*/
  
  /************** Descriptor of Joystick Mouse interface ****************/
  /* 09 */
  0x09,         /*bLength: Interface Descriptor size*/
  USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/
  0x00,         /*bInterfaceNumber: Number of Interface*/
  0x00,         /*bAlternateSetting: Alternate setting*/
  0x01,         /*bNumEndpoints*/
  0x03,         /*bInterfaceClass: HID*/
  0x00,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/
  0x00,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/
  0,            /*iInterface: Index of string descriptor*/
  /******************** Descriptor of Joystick Mouse HID ********************/
  /* 18 */
  0x09,         /*bLength: HID Descriptor size*/
  HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/
  0x11,         /*bcdHID: HID Class Spec release number*/
  0x01,
  0x00,         /*bCountryCode: Hardware target country*/
  0x01,         /*bNumDescriptors: Number of HID class descriptors to follow*/
  0x22,         /*bDescriptorType*/
  HID_MOUSE_REPORT_DESC_SIZE,/*wItemLength: Total length of Report descriptor*/
  0x00,
  /******************** Descriptor of Mouse endpoint ********************/
  /* 27 */
  0x07,          /*bLength: Endpoint Descriptor size*/
  USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/
  
  HID_IN_EP,     /*bEndpointAddress: Endpoint Address (IN)*/
  0x03,          /*bmAttributes: Interrupt endpoint*/
  HID_IN_PACKET, /*wMaxPacketSize: 4 Byte max */
  0x00,
  0x0A,          /*bInterval: Polling Interval (10 ms)*/
  /* 34 */
} ;
Код:
__ALIGN_BEGIN static uint8_t USBD_HID_Desc[USB_HID_DESC_SIZ] __ALIGN_END=
{
  /* 18 */
  0x09,         /*bLength: HID Descriptor size*/
  HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/
  0x11,         /*bcdHID: HID Class Spec release number*/
  0x01,
  0x00,         /*bCountryCode: Hardware target country*/
  0x01,         /*bNumDescriptors: Number of HID class descriptors to follow*/
  0x22,         /*bDescriptorType*/
  HID_MOUSE_REPORT_DESC_SIZE,/*wItemLength: Total length of Report descriptor*/
  0x00,
};
Код:
__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE] __ALIGN_END =
{
  0x05, 0x40, // USAGE_PAGE (Instruments)
 0x09, 0x00, // USAGE (Undefined)
 0xA1, 0x00, // COLLECTION (Vendor Defined)

 0x75, 0x08, // REPORT_SIZE (8 bits)
 0x95, 0x30, // REPORT_COUNT (48 bytes)
 0x09, 0x00, // USAGE (0)
 0x81, 0x00, // INPUT (Data,Var,Abs)

 0x75, 0x08, // REPORT_SIZE (8 bits)
 0x95, 0x10, // REPORT_COUNT (16 bytes)
 0x09, 0x00, // USAGE (0)
 0x91, 0x00, // OUTPUT (Data,Var,Abs)

 0xC0 // END_COLLECTION
};

Последний раз редактировалось swat24; 29.11.2013 в 15:02.
swat24 вне форума  
Непрочитано 29.11.2013, 15:22  
Hives
Гражданин KAZUS.RUN
 
Регистрация: 25.11.2010
Сообщений: 516
Сказал спасибо: 1
Сказали Спасибо 126 раз(а) в 109 сообщении(ях)
Hives на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

вечером детально пройдусь, если кто еще не поможет.
Hives вне форума  
Сказали "Спасибо" Hives
swat24 (29.11.2013)
Непрочитано 29.11.2013, 15:41  
realid
Супер-модератор
 
Аватар для realid
 
Регистрация: 15.10.2007
Сообщений: 3,578
Сказал спасибо: 175
Сказали Спасибо 1,567 раз(а) в 810 сообщении(ях)
realid на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

В определении HID_IN_PACKET(и HID_OUT_PACKET, не вижу описания OUT_EP) задать 64.
Вот с рабочего тестового проекта составного MassStorage+HID.
Код:
__ALIGN_BEGIN uint8_t USBD_MSC_CfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
{
  
  0x09,   /* bLength: Configuation Descriptor size */
  USB_DESC_TYPE_CONFIGURATION,   /* bDescriptorType: Configuration */
  USB_MSC_CONFIG_DESC_SIZ,
  
  0x00,
  0x02,   /* bNumInterfaces: 2 interface */
  0x01,   /* bConfigurationValue: */
  0x04,   /* iConfiguration: */
  0xC0,   /* bmAttributes: */
  0xFA,   /* MaxPower 500 mA */
  
  /********************  Mass Storage interface ********************/
  0x09,   /* bLength: Interface Descriptor size */
  0x04,   /* bDescriptorType: */
  0x00,   /* bInterfaceNumber: Number of Interface */
  0x00,   /* bAlternateSetting: Alternate setting */
  0x02,   /* bNumEndpoints*/
  0x08,   /* bInterfaceClass: MSC Class */
  0x06,   /* bInterfaceSubClass : SCSI transparent*/
  0x50,   /* nInterfaceProtocol */
  0x05,          /* iInterface: */
  /********************  Mass Storage Endpoints ********************/
  0x07,   /*Endpoint descriptor length = 7*/
  0x05,   /*Endpoint descriptor type */
  MSC_IN_EP,   /*Endpoint address (IN, address 1) */
  0x02,   /*Bulk endpoint type */
  LOBYTE(MSC_MAX_PACKET),
  HIBYTE(MSC_MAX_PACKET),
  0x00,   /*Polling interval in milliseconds */
  
  0x07,   /*Endpoint descriptor length = 7 */
  0x05,   /*Endpoint descriptor type */
  MSC_OUT_EP,   /*Endpoint address (OUT, address 1) */
  0x02,   /*Bulk endpoint type */
  LOBYTE(MSC_MAX_PACKET),
  HIBYTE(MSC_MAX_PACKET),
  0x00,     /*Polling interval in milliseconds*/
  
  /************** HID interface ****************/
  /* 09 */
  0x09,         /*bLength: Interface Descriptor size*/
  USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/
  0x01,         /*bInterfaceNumber: Number of Interface*/
  0x00,         /*bAlternateSetting: Alternate setting*/
  0x02,         /*bNumEndpoints*/
  0x03,         /*bInterfaceClass: HID*/
  0x00,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/
  0x00,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/
  0,            /*iInterface: Index of string descriptor*/
  /******************** Specific Descriptor of HID ********************/
  /* 18 */
  0x09,         /*bLength: HID Descriptor size*/
  HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/
  0x11,         /*bcdHID: HID Class Spec release number*/
  0x01,
  0x00,         /*bCountryCode: Hardware target country*/
  0x01,         /*bNumDescriptors: Number of HID class descriptors to follow*/
  0x22,         /*bDescriptorType*/
  HID_REPORT_DESC_SIZE,/*wItemLength: Total length of Report descriptor*/
  0x00,
  /******************** Descriptor of Mouse endpoint ********************/
  /* 27 */
  0x07,          /*bLength: Endpoint Descriptor size*/
  USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/
  
  HID_IN_EP,     /*bEndpointAddress: Endpoint Address (IN)*/
  0x03,          /*bmAttributes: Interrupt endpoint*/
  HID_IN_PACKET, /*wMaxPacketSize: 64 Byte max */
  0x00,
  0x01,          /*bInterval: Polling Interval (1 ms)*/
  
  /* 36 */
  0x07,          /*bLength: Endpoint Descriptor size*/
  USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/
  
  HID_OUT_EP,     /*bEndpointAddress: Endpoint Address (IN)*/
  0x03,          /*bmAttributes: Interrupt endpoint*/
  HID_OUT_PACKET, /*wMaxPacketSize: 64 Byte max */
  0x00,
  0x01,          /*bInterval: Polling Interval (1 ms)*/
};

__ALIGN_BEGIN static uint8_t HID_ReportDesc[HID_REPORT_DESC_SIZE] __ALIGN_END =
{
    0x06, 0x00, 0xFF,       // Usage Page = 0xFF00 (Vendor Defined Page 1)
    0x09, 0x01,             // Usage (Vendor Usage 1)
    0xA1, 0x01,             // Collection (Application)
    0x19, 0x01,             //      Usage Minimum 
    0x29, 0x40,             //      Usage Maximum 	//64 input usages total (0x01 to 0x40)
    0x15, 0x00,             //      Logical Minimum (data bytes in the report may have minimum value = 0x00)
    0x26, 0xFF, 0x00, 	  	//      Logical Maximum (data bytes in the report may have maximum value = 0x00FF = unsigned 255)
    0x75, 0x08,             //      Report Size: 8-bit field size
    0x95, 0x40,             //      Report Count: Make sixty-four 8-bit fields (the next time the parser hits an "Input", "Output", or "Feature" item)
    0x81, 0x00,             //      Input (Data, Array, Abs): Instantiates input packet fields based on the above report size, count, logical min/max, and usage.
    0x19, 0x01,             //      Usage Minimum 
    0x29, 0x40,             //      Usage Maximum 	//64 output usages total (0x01 to 0x40)
    0x91, 0x00,             //      Output (Data, Array, Abs): Instantiates output packet fields.  Uses same report size and count as "Input" fields, since nothing new/different was specified to the parser since the "Input" item.
    0xC0                    // End Collection
};

Последний раз редактировалось realid; 29.11.2013 в 15:47.
realid вне форума  
Сказали "Спасибо" realid
swat24 (29.11.2013)
Непрочитано 29.11.2013, 16:46  
swat24
Гражданин KAZUS.RUN
 
Регистрация: 16.03.2009
Адрес: Украина, Харьков
Сообщений: 762
Сказал спасибо: 108
Сказали Спасибо 67 раз(а) в 67 сообщении(ях)
swat24 на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

Работает отправка 64 байт взял пример который скачивал раньше, вставил в него репорт Hives.

С отправкой с компа разобрался, вроде работает.А прием данных сделать в static uint8_t USBD_HID_DataOut (void *pdev, uint8_t epnum) ? Там заполнится массив приема и тогда я его уже обрабатываю как мне нужно, правильно?

Последний раз редактировалось swat24; 29.11.2013 в 17:57.
swat24 вне форума  
Непрочитано 30.11.2013, 07:20  
Hives
Гражданин KAZUS.RUN
 
Регистрация: 25.11.2010
Сообщений: 516
Сказал спасибо: 1
Сказали Спасибо 126 раз(а) в 109 сообщении(ях)
Hives на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

разберитесь уже что у вас значит "прием" а что "отправка", а то я уже запутался.
или пишите полностью - "прием данных в устройстве от компа" и т.п.
и судя по названию функции "USBD_HID_DataOut" - это как раз передача PC-›Dev
// напоминаю, для USB все операции обзываются с точки зрения хоста, т.е. PC
// соотв. OUT - передача PC-›Dev, IN - передача Dev-›PC
Hives вне форума  
Непрочитано 30.11.2013, 20:28  
swat24
Гражданин KAZUS.RUN
 
Регистрация: 16.03.2009
Адрес: Украина, Харьков
Сообщений: 762
Сказал спасибо: 108
Сказали Спасибо 67 раз(а) в 67 сообщении(ях)
swat24 на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

Меня интересует прием данных на устройстве. Как я понимаю функция USBD_HID_DataOut вызывается каждый раз. И при передачи данных с компа и при запросе репортов.
А результат сохраняется в буфер, который условием надо проверять моя это посылка или комп запрашивает репорты. Правильно я думаю?

Написал так:
Код:
static uint8_t  USBD_HID_DataOut (void *pdev, uint8_t epnum)
{
	uint16_t USB_RecData_Cnt;
	BitAction Led_State;
	if (epnum == HID_OUT_EP)
	{
		/* Get the received data buffer and update the counter */
		USB_RecData_Cnt = ((USB_OTG_CORE_HANDLE*)pdev)-›dev.out_ep[epnum].xfer_count;
		/* USB data will be immediately processed, this allow next USB traffic being
		   NAKed till the end of the application Xfer */
		if (((USB_OTG_CORE_HANDLE*)pdev)-›dev.device_status == USB_OTG_CONFIGURED )
		{		// проверка моя отправка или нет	
				if ((Buffer[0]==1)&&(Buffer[1]==77))
				{
					 USBD_HID_SendReport (&USB_OTG_dev, Buffer, 64);
				}
			/* Prepare Out endpoint to receive next packet */
			DCD_EP_PrepareRx(pdev,
			                   HID_OUT_EP,
			                   (uint8_t*)(Buffer),
			                   HID_OUT_PACKET);
			
		}
	}
	return USBD_OK;
}
Но оно отправляет мне все подряд. Т.е. отправляю mass[0..64]. mass[0]=1; mass[1]=77, остальные 0xFF; а присылается следующее:
Код:
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 01 4D 3F EA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Мало того, что не то, так еще и в таком количестве... Когда пошагово прохожу условие на устройство приходит пакет в начале у которого 01,4D, но в ответ шлет что попало...

В общем. если ограничиться 2 байтами на прием на устройстве и на 64 отправки с АРМ, то все работает. Единственное что отправляет два моих байта и еще два дополнительных. Похоже это как контрольная сумма. При изменении отправки меняется и следующие два байта за ними. Для начала думаю сгодится, т.к. два байта мне с головой хватит. Будет только управление с компа.

Последний раз редактировалось swat24; 30.11.2013 в 22:50.
swat24 вне форума  
Непрочитано 30.11.2013, 23:01  
Impartial
Прописка
 
Регистрация: 09.02.2011
Сообщений: 164
Сказал спасибо: 1
Сказали Спасибо 27 раз(а) в 22 сообщении(ях)
Impartial на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

Сообщение от swat24 Посмотреть сообщение
Но оно отправляет мне все подряд. Т.е. отправляю mass[0..64]. mass[0]=1; mass[1]=77, остальные 0xFF; а присылается следующее:
А где в дескрипторе отчета идентификатор с номером 1?
Добавьте
0x85, 0x01, // REPORT_ID (1)

Нулевым байтом в HID посылке всегда идет номер отчета.
Impartial вне форума  
Непрочитано 30.11.2013, 23:08  
swat24
Гражданин KAZUS.RUN
 
Регистрация: 16.03.2009
Адрес: Украина, Харьков
Сообщений: 762
Сказал спасибо: 108
Сказали Спасибо 67 раз(а) в 67 сообщении(ях)
swat24 на пути к лучшему
По умолчанию Re: STM32F4 USB HID составление репорта

эээ, тоже об этом думал, пробовал добавить - устройство перестало отвечать тем более я пока не совсем понял как мне этот идентификатор отправлять с компа. Он получается отдельно от моего отправляемого массива. Т.е. массив сейчас состоит из 2 элементов, а отправляется 3 с первым нулевым идентификатором.

И опять же, отправляю один раз 0x4d 0x16, а возвращается следующее:
Код:
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4D 16 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 4A D1 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00 
00 00 00

Последний раз редактировалось swat24; 30.11.2013 в 23:13.
swat24 вне форума  
 
Опции темы

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Печатная плата USBee AX picavr Барахолка электронных компонентов 950 20.08.2023 17:11
Не могу запустить USB контроллер ATMega32U4 Slava1355 AVR 12 29.09.2014 14:58
VB.NET USB HID Easyrider83 Микроконтроллеры, АЦП, память и т.д 28 27.09.2011 12:43
USB HID девайс на 18F13K50 не хочет работать. DK Микроконтроллеры, АЦП, память и т.д 17 26.02.2010 18:31
USB HID PIC18F4550 нужна помощь! tower2007 Микроконтроллеры, АЦП, память и т.д 0 17.04.2008 04:33


Часовой пояс GMT +4, время: 07:15.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.