Composite device MSD (SD card) + HID: MSD works, HID device "cannot start" code 10
I am working on a project with PIC18LF26J50 and want to implement a composite device with the following features:
- USB datalogger with SD card mass memory device
- HID device for control purposes (e.g. to setup the datalogger, set RTC time etc.)
So far the datalogger and SD card mass memory device work fine, but I can't get the HID device working.
The mass memory appears on the PC and is fully accessible, the HID device appears in the PC device manager with a question mark and error code 10 ("This device cannot start") and is not accessible through the PC demo application.
I have checked my code several times and couldn't find anything wrong. I have also read a lot of entries in this forum that describe similar problems but didn't find anything that helped me to find out why it doesn't work.
Here is how I have proceeded:
1. I have started with the project "Device - Mass Storage - SD Card data logger" from the USB Microchip application library. I have adapted the code to my hardware and got this project running ok on my hardware.
2. After that, I have continued with the project "Device - Composite - HID + MSD" from the same library and again adapted the code to my hardware. This was also successful, the PC demo application recognizes the hardware and I can read and write data through the HID endpoint. I can also access the file system through the Windows explorer.
This project is already quite close to what I want to do, the major difference is that it uses the internal flash of the processor instead of the SD card.
3. Now I have tried to merge both projects, starting with the data logger project:
- Added usb_function_hid.c and usb_function_hid.h
- Edited usb_config.h: 2 Endpoints, added USE_HID and endpoint allocation definitions for HID
- Used usb_descriptors.c from the Composite HID + MSD project (as the data length of configDescriptor1 was different).
- All in all the descriptors in the merged project should now be the same as in the Composite project.
The merged project compiles without errors and does not cause USB error messages on the PC, but only the MSD function works.
The enumeration seems to work and the device state ends properly up in CONFIGURED_STATE.
As both the merged project and the Composite device project can be loaded on the same hardware, I can directly compare how they appear in the device manager on the PC. Except the "Code 10 - This device cannot start" error and the fact that the PC demo application does not recognize it, there seems to be no difference between the merged project and the composite HID + MSD project.
I am quite sure that I am overlooking something, but after having checked everything several times I have no more idea what to look after.
So I hope that someone can give me a hint what the reason might be or how to proceed.
I greatly appreciate any help. Thanks.
post edited by crashpilot - 2013/05/23 09:47:56