Hi I have made a simple program for LPC4337 Device, this is my code for initiating the HID mouse that I have connected to my board. The problem is that I got this error usbDeviceError
and my USB function initialize Ok
int main(void) { osKernelInitialize (); // initialize RTOS kernel osKernelStart (); // start kernel with job2 execution usbStatus usbst; usbst=USBH_Initialize(0); // USB Host 0 Initialize while(1) { usbst=USBH_HID_GetDeviceStatus (0U); // Get HID device status } }
Finally It decided to work, The problem was nothing except the 10 different mouses and keyboards that I have used, none of them Seems to be HID!!! and the Last mouse That I have connected to the system it's being detected and working properly.
I have tried the custom Class for detecting other keyboard and mouses, It seems that the USB host would not find anything, and my custom class code detect the mouse that is HID compatible!
Here is my Code for the custom class Testing to see if I could detect the other mouse and keypads. It seems there is something wrong with the USB LIB.
static int whatCallback=0; usbStatus USBH_CustomClass_Initialize (uint8_t instance) { whatCallback=1; } uint8_t USBH_CustomClass_Configure ( const USBH_DEV * ptr_dev,const USB_DEVICE_DESCRIPTOR * ptr_dev_desc,const USB_CONFIGURATION_DESCRIPTOR * ptr_cfg_desc ) { whatCallback=2; } usbStatus USBH_CustomClass_Uninitialize (uint8_t instance) { whatCallback=3; } usbStatus USBH_CustomClass_Unconfigure ( uint8_t instance ) { whatCallback=4; } int main(void) { USBH_Initialize (0); /* Initialize USB Host 0 */ while(1) { USBH_CustomClass_GetDeviceStatus(0); } }
Hi Ali,
it would be very helpful if you could see USB bus traffic, as a lot could be concluded from that.
There is however a way for you to get more information on what is going on in the USB Library. You can use so called Event Recorder and Debug variant of the USB Library and look into debug messages that USB Library will output.
To enable Event Recorder you need do the following: In Manage Run-Time Environment you should: - Component Compiler:Event Recorder:DAP check the checkbox - Component USB:CORE select Debug variant instead of Release In your main file: - add #include "EventRecorder.h" - in start of main function call EventRecorderInitialize (EventRecordAll, 1);
Then build the project, download to flash, start the debug session (Ctrl +F5), go to menu View -> Analysis Window -> Event Recorder
In Event Recorder window you should see debug messages output by USB Library, that should help you to determine what is going on in the USB Library.
Best regards, Milorad
Thanks Milorad I will try it and share results in here.
I have tested the Event recorder, There are some errors out there Please see the attached file for detailed info, I do not understand errors and how to solve them. what's Error=65 ?
Do you have any Idea why the custom class can not find my other non-HID mouse and keybaords? it seems all of my 10 different mouses generate the same data!
get the Event recorder data file at here
www.4shared.com/.../Genius_mouse_on_LPC4370_USB_Ho.html
See some pictures in here https://ibb.co/f3ehaa
errors are enumerated in rl_usb.h file in c:\Keil\ARM\PACK\Keil\MDK-Middleware\7.3.0\USB\Include\ folder. Error 65 is transfer error.
I suggest you contact Keil support, and send them .csv file.
I can not download your file as I do not have the account there.
Thanks for your suggestions,In here you can get the file without an account
https://ufile.io/2fa111
Contacting support is a time consuming task. and the info wouldn't be public for everybody.
Thanks for your time.