We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello anyone,
After reading and searching over the net, I cannot find a solution and I think I need some help.
Scenario: I am developing a HID device using an Atmel AT91SAM7X256 (ARM7TDMI). This device exchanges some data with a windows application that I am writing using Embarcadero RAD X3 and Jvcl HID device component on Windows7.
Problem: The problem arrives when I start a debug session on uVision ( I am using ULink2 ). When the debugger is running (programming or debugging), my application issues an error that say: "device cannot be opened". This problem is not related to my hid device because it happens even if my device is disconnected from the usb cable. From Embarcadero I can see that this error happens after the loading of hid.dll and no exception is raised from my code. No problem happens if i use my hid device whith my windows application whitout debugging the hid device. I seems to me that uVision open hid.dll driver in exclusive mode or something similar so no other application can open or use it. I am start thinking that because it is like the device named in the error is the usb controller, not the hid device that is disconnected at the time.
I hope someone can help me.
I have tried using Segger J-Link Pro: no problem, all works. Then I have switched to Ulink2: problem happens. This is something related to ULink2 and the driver. Or maybe can be a bug of the uvision ide.
Anecdotal evidence would seem to support that notion: http://www.keil.com/forum/14502/
I don't see any problem to open HID device, while uVision/ ULINK2 runs debug session. Sound like problem lies in "Jvcl HID device component".
> When the debugger is running (programming or debugging), my application issues an error that say: "device cannot be opened". This problem is not related to my hid device because it happens even if my device is disconnected from the usb cable.
To find target HID device in standard MS method, application (or DLL) scans all HID device. It opens each HID device in turn, to get detailed information of the device, like VID/PID of the device. If this scanner would exclusively open ULINK2 (a HID device) using CreateFile(), and if uVision would have already opened the ULINK2, CreateFile() should fail. So, don't open scanned device exclusively. Maybe "Jvcl HID device component" falls in this trap.
Ask it to the developer of the component.
Tsuneo
Thank you Tsuneo for your reply. The jVcl hid component calls a function passing the vid and pid. My code verify if they are the correct vid and pid and if they are, calls the open file:
. . TJvHidDevice *HidDevice; . . bool __fastcall TForm1::JvHidDeviceController1Enumerate(TJvHidDevice *HidDev, const int Idx) {
if( ( HidDev->Attributes.VendorID == NBW_VID ) && ( HidDev->Attributes.ProductID == NBW_PID ) ){
JvHidDeviceController1->CheckOutByIndex(HidDev,Idx);
HidDevice = HidDev;
HidDevice->OpenFile();
}
return true;
I not know if the JVcl hid component opens it before me or takes this informations from the windows registry, I will investigate on this. The strange fact is that this problem will arrise only with the ulink2 and only if it is debugging: no other hid device gives me the problem.