• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 25, 2024, 01:52:12 pm

News:

SMF - Just Installed!


Reading/Writing USB Device

Started by Alycat, September 08, 2011, 09:20:21 pm

Previous topic - Next topic

Alycat

OK, thanks - testing progressing...

Alycat

When using
nrUsbDriver1.Install()
does that install a 32 bit or 64 bit or does it auto detect and install the correct driver?

Roman Novgorodov

Hello

Install auto detects platform and installs necessary driver.

But please note that if your are using WinUSB you need place in to project needed resource (TnrUsbDriver32bit and TnrUsbDriver64bit)
For nrUsb all drivers are included into resource by default.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Alycat

As mentioned, I wrote a small test program, along the lines of the above, a button to setup and another button to start (by setting active to true). All works fine.
I am using your nr driver, not WinUSB.
I then included the same code in my main program, setup runs, but starting generates an error, that the driver is not installed.
I then copied the actual unit and form from the test program in, and included that form, still fails.
I then moved the creation and display of the test form to the very start of the boot process of my program, still failed.
Is there something obvious I am missing here? I reran my small test program and it still works fine.

Roman Novgorodov

Hello

Please create simple project that shows error and upload source here. We will check.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Alycat

Eeerr, that's the point, the simple test program works fine, it is only when the same code is included in the main program that it fails.

Alycat


Alycat

I have managed to reproduce the problem, with all my main units commented out, have emailed the dpr and dproj file, which now only uses madExcept, FastMM and a small test unit, Unit1 (pas and dfm sent as well).

Alycat

Looks like it is a problem between your component and FastMM... you take FastMM out and it seems to work.

Roman Novgorodov

Hello

nrComm Liv does not contain FastMM unit.
I received your email with attachment. We will check it.

Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Alycat

Back to my test program...
The following is called to setup the device:
var
dev:integer;
begin
   ListBox1.Items.Add('Setup starting...');
   ListBox1.Refresh;
   nrUSB1.Update;
   dev:=nrUSB1.DeviceIndexOf(...,...);
   ListBox1.Items.Add('Device found at index: '+inttostr(dev));
   nrUSB1.SetDeviceIndex(dev);
   ListBox1.Items.Add('Device index set: '+inttostr(nrUSB1.DeviceIndex));
   ListBox1.Items.Add('Setup finished.');
   ListBox1.Refresh;
the following to start the device:
    nrUSB1.Active := true;
    nrUSBPipePair1.Active := true;

This works ok.
If the setup is called again, nothing works, looks like the PipePair's receive data does not trigger.
I included setting of pipein and pipeout in the setup, it seems to read a bit of data, then stop.

Roman Novgorodov

Hello

Better if you will close all before refresh device list and change DeviceIndex:


...
begin
    nrUSBPipePair1.Active := false;    // <!!!!
    nrUSB1.Active := false;               // <!!!!
   ListBox1.Items.Add('Setup starting...');
   ListBox1.Refresh;
   nrUSB1.Update;
   ....


Roman Novgorodov
DeepSoftware LLC
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

Alycat


Alycat

Tried it, first time I ran setup for the second time and then start, about 4 records displayed (maybe already in the buffer), then stopped. Now, it is strange, not working correctly, looking...

Alycat

Had to get the usb device rebooted...
Ran the earlier test program, all ok, provided setup not run twice.
Setting nrUSB and PipePair Active to false in setup causes problems, everything stops responding, setup runs ok, but start fails to produce any data???