Author Topic: Reading/Writing USB Device  (Read 7116 times)

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #30 on: October 01, 2011, 04:07:31 pm »
Hello

Please check that length of outgoing data is not greater than MaxPacket size of pipe.
See USBBrowser for look at pipe properties.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #31 on: October 01, 2011, 11:36:33 pm »
Please check that length of outgoing data
Is this data going to the device or coming from the device?
Quote
is not greater than MaxPacket size of pipe
PipePair does not have a property in the designer of MaxPacket? How and when do I set it?
Quote
See USBBrowser for look at pipe properties.
My demo programs does not included USBBrowser?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #32 on: October 02, 2011, 09:02:05 am »
Hello

You can find USBBrowser shortcut in nrComm group of Start menu.
Select needed device and its pipe and see properties.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #33 on: October 06, 2011, 12:04:32 am »
Please check that length of outgoing data is not greater than MaxPacket size of pipe.
Ok, Max Packet Size is 8, for both pipes.
Outgoing data, I am sending only about 20 char's or so in the setup.
The packet size, what is 8 measured in?
 

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #34 on: October 06, 2011, 03:29:43 pm »
Hello

Please try separate your data sending to several DataSend() calls with max data length 8 char (bytes)

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #35 on: October 06, 2011, 11:53:57 pm »
Please try separate your data sending to several DataSend() calls with max data length 8 char (bytes)
Please see above, the setup code does not send any data to the USB.
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;

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #36 on: October 07, 2011, 01:54:56 am »
Hello


Code: [Select]
... I am sending only about 20 chars ..
I don't see sending code in your sample.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #37 on: October 07, 2011, 03:33:00 am »
No, my mistake, the test program, as above, does not send any data. The real program does, but it is not being worked on because of the problem with your component and FastMM.
The USB device is running all the time, so would be sending data- I am wondering if the test program as above has hit the limit of reading data because of being the demo version.
There are two problems here it seems. If I use the "setup" button twice it stops reading. I have not tested it much lately, and now it reads about 15 or 20 records and stops. I reboot, and it reads, but only 15 or 20 records again.
TeamViewer is open if you want to look.
 

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #38 on: October 09, 2011, 09:08:03 am »
Hello

Please note that you did not install driver every time before work with USB device.
It is one-time operation.

You need install driver if USB device opening returns exception about wrong driver.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #39 on: October 10, 2011, 07:55:34 am »
I am not installing the driver each time.
The main problem is that the test program reads a dozen or so records and stops, rerunning it will not read anything, requires a laptop reboot.
 

Alycat

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #40 on: October 22, 2011, 10:41:47 pm »
Any progress?
(1) The USB component does not work with FastMM, demo program sent.
(2) If the USB device has been on for a while, with presumably lots of records waiting to be read, only 10 or 20 records get read, and the computer needs to be rebooted - demo program sent.
(3) If our setup routine is called twice, USB stops working, demo program sent.
 

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #41 on: October 28, 2011, 01:34:30 pm »
Hello

We are trying to reproduce problem with our hardware on our side. While we ca not reproduce your situation.

Please try to run DBGVIEW utility, switch on its Kernel mode and repeat problem with your program.

Possible DBGVIEW will show more info from kernel driver. Give me its LOG file.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #42 on: October 31, 2011, 01:26:34 am »
All 3 problems? FastMM is not a problem when you run?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Reading/Writing USB Device
« Reply #43 on: November 02, 2011, 04:08:05 pm »
Hello

No. DBGView will show (possible) warning from kernel driver code.

XE2 has built-in FastMM and it does not reports about any leaks or other problems. All our demos are compiled in XE2 and work good.

Also I recommend you to try latest version 9.25. It has some corrections in driver and usb calls.

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

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Reading/Writing USB Device
« Reply #44 on: November 02, 2011, 09:48:37 pm »
XE2 has built-in FastMM and it does not reports about any leaks or other problems. All our demos are compiled in XE2 and work good.
I think XE has a copy of FastMM built in, so did some earlier versions, BUT there never seems to be any leak messages  - do you ever get a leak message using the built in FastMM???
 
Quote
Also I recommend you to try latest version 9.25. It has some corrections in driver and usb calls.
Where do I get that, I can't see any version numbers on your download page, nrComm.zip seems to date from September?