Transplant St Official Usb-hid program appears babble detected error

Source: Internet
Author: User

I am in the transplant St official Usb-hid program is can run, but when I modify the maximum package babble detected error occurred, according to the operation of the network, modify the maximum buffer needs to modify 3 places, (1) usb_desc.c file customhid_ CONFIGDESCRIPTOR[CUSTOMHID_SIZ_CONFIG_DESC] Array, modifying the maximum packet size of the input and output of the endpoint 1, and (2) modifying the void Customhid_reset (void) function in the Usb_prop.c file. There is the need to set the packet size of the endpoint 1, the function Seteptxcount (ENDP1, 4), (3) stm32f10x_it.c in the interrupt handler to modify the sending endpoint 1 the size of the sending packet, for these modifications, but the bus hound software to do the test, There was a babble detected error, said host host that appears to receive data overflow, but if not change the size of the sending packet 2, there will be no error, it appears to be set the endpoint 1 of the sending packet size setting problems, and later found on the internet, It is found that the USB report descriptor is not modified (the report descriptor), that the USB HID device is reported to transmit data through reports, reports have input reports and output reports. The input report is a USB device sent to the host, such as a USB mouse to move the mouse and mouse clicks and other information returned to the computer, should be reported to describe character with a key operation, the packet size sent,

In the key section of the report descriptor, add the last sentence 0x95,0x04, set the corresponding key operation to send the data segment portion of the packet is 4 bytes;

/* Key Push Button */
    0x85, 0x05,            /*     REPORT_ID (5)              */
    0x09, 0x05,           and nbsp;/*     USAGE (Push Button)        */
    0x15, 0x00,            /*     logical_minimum (0)        */
    0x25, 0x01, &nbs P          /*     Logical_maximum (1)        */
    0x7 5, 0x01,            /*     report_size (1)           &NBS p;*/
   0x95,0x04,            //Report_count (4Byte)  

After the above operation, you need to modify the report descriptor size Customhid_siz_report_desc, select Customhid_siz_report_desc Right click on the mouse, enter the definition, add his length 1, so that does not appear babble Detected error, under the button trigger, you can send 4 bytes of data, if the byte content to send is not only 0 or 1, to modify the above

0x15, 0x00,/* logical_minimum (0) */
0x25, 0x01,/* Logical_maximum (1) */

Section 0x15, 0x00,/* logical_minimum (0) */
0x25, 0xFF,/* Logical_maximum (255) */

It is possible to send data between 0~255.

Usb-hid just learn, basically do not understand, there is something wrong place please criticize, thank you

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.