ContourDesign Shuttle Forum

User forums for Contour Design ShuttlePROv2, ShuttleXpress and the original ShuttlePRO
* Login   * Register

Search Help, Settings, FAQs

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: USB HID device error
PostPosted: Sat Dec 09, 2017 6:05 am 

Joined: Sat Dec 09, 2017 5:29 am
Posts: 1
I'm trying to fix an error This device cannot start. (Code 10) with a USB HID device I'm building. Here are some details on my project:


MCU: PIC32MX250F128B(
Programmer: Microstick II
Git Repository:

Please refer to the code above, it's not big, I'm trying not to flood the question with source code ;)


The device enumerates, and I'm able to see that Windows 7 and Mac OS X is able to identify the device.

However in Windows, I'm getting an error: This device cannot start. (Code 10)

I've been trying to fix this for a while. After redoing my breadboard wiring last week to try and improve the signal quality, I've come, trying to alter my code to get things working.

I'm using USB_INTERRUPT mode, and have my descriptor looks as follows:


     0x12,                       // Descriptor size in bytes 
     USB_DESCRIPTOR_DEVICE,      // Device descriptor type 
     0x0200,                     // USB spec release number in BCD format 
     0x00,                       // Class code 
     0x00,                       // Subclass code 
     0x00,                       // Protocol code 
     USB_EP0_BUFF_SIZE,          // Max packet size for EP0 
     MY_VID,                     // Vendor ID 
     MY_PID,                     // Product ID 
     0x0001,                     // Device release number in BCD format 
     0x01,                       // Manufacturer string index 
     0x02,                       // Product string index 
     0x00,                       // Device serial number string index 
     0x01                        // Number of possible configurations 

and the HID report discriptor, (built with HID Tool from
ROM struct{BYTE report[HID_RPT01_SIZE];} hid_rpt01 =
        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
        0x09, 0x04,                    // USAGE (Joystick)
        0xa1, 0x01,                    // COLLECTION (Application)
        0x09, 0x04,                    //   USAGE (Joystick)
        0xa1, 0x00,                    //   COLLECTION (Physical)
        0x05, 0x09,                    //     USAGE_PAGE (Button)
        0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
        0x29, 0x08,                    //     USAGE_MAXIMUM (Button 8)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
        0x95, 0x08,                    //     REPORT_COUNT (8)
        0x75, 0x01,                    //     REPORT_SIZE (1)
        0x81, 0x02,                    //     INPUT (Data,Var,Abs)
        0xc0,                          //     END_COLLECTION
        0xc0                           // END_COLLECTION

The above represents a Joystick with one button, so I'm trying to start small. My HID report looks like this:
     BYTE buttons;


I've also set the descriptor size to 28 bytes in usb_config.h:
#define HID_RPT01_SIZE 28

This is about the furthest I've come with this project ever, but I'm face to face with a brick wall, that won't budge. Any help would be much appreciated. The full contents of main.c is at my GitHub repository

I'm testing my device on both Mac and Windows 7 via VMWare. The Microstick II doesn't appear to have the best debugger, so debugging is limited.

What I've done is light up an LED on Pin 2 (RA0) when USBDeviceState == CONFIGURED_STATE, and all I know is that the device is in CONFIGURED_STATE, as the LED lights up a few moments after the device is plugged in. I also managed to get the following from the USBLizer trial version:

I can't set breakpoints in MPLABX, and halt the MCU to investigate the issue, because of USB clock timing requirements, so really stuck as to how I can troubleshoot and fix this.

For what it's worth, I've set a breakpoint for the EVENT_BUS_ERROR handler in main.c, and the following U1EIR registers' bits are set:

    *DFN8EF - Data Field Size Error Flag bit
    *CRC5EF_EOFE - CRC5 Host Error Flag bit
    *PIDEF - PID Check Failure Flag bit


Am I getting these errors because I'v entered debug mode and the chip isn't happy, and these aren't the actual errors at all, and if these errors are in fact correct indications of my problem, what does it mean?

If I'm getting a DFN8EF - Data Field Size Error Flag bit, how do I figure out what data field is the wrong size? It's likely to be my descriptor, or HID report, but I can't find the fault.

Report this post
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Powered by phpBB® Forum Software © phpBB Group
It is currently Sun Jan 21, 2018 8:02 pm