Author Topic: nrUSB.SendData show Abstract Error  (Read 50 times)

epareja2

  • Newbie
  • *
  • Posts: 2
    • View Profile
nrUSB.SendData show Abstract Error
« on: August 27, 2017, 05:50:48 am »
Hello,

I'm new to nrCommLib and I'm trying to send and receive data to a WinUSB device.
The device is detected and enumerated by windows and I activate it to be ready for sending data.
Code: [Select]
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  nrUSB1.SetDeviceIndex(USBIndexList[ComboBox1.ItemIndex]); // This is a normal combo that stores only the VID specific devices
  try
    nrUSB1.Active := CheckBox1.Checked
  except
    raise;
    CheckBox1.Checked :=     nrUSB1.Active;
  end;

end;

In the sending routine I'm doing this
Code: [Select]
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  Buff : array [1..5] of byte;
  BuffIn : array [1..5] of byte;
begin
  Buff[1] := $05;
  Buff[2] := $0;
  Buff[3] := $FA;
  nrUSB1.SendData(@Buff[1],3);
end;

In the SendData function I get an error with the text "Abstract Error". What could be happening?

Thank you

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: nrUSB.SendData show Abstract Error
« Reply #1 on: August 27, 2017, 11:54:16 am »
Hello

USB device usual  provides several (more than one) IO channels (pipes).
You need to assign TnrUSBPipePair to TnrUsb.
And you can call
        nrUSBPipePair1.SendChar();
        nrUSBPipePair1.SendString();
        nrUSBPipePair1.SendData();

You can refer to following demo project:
Demos\USBIODemo\usbiodemo.dpr
Demos\USBPipeDemo\usbpipedemo.dpr

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.

epareja2

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: nrUSB.SendData show Abstract Error
« Reply #2 on: August 27, 2017, 02:58:47 pm »
Thank you Romman for your answer.

Now I'm facing the problem of the driver when I try to activate the nrUSB. (In the code I posted I was checking the wrong checkbox).

My device is WinUSB and is working with the JEDI component but I want to use the nrcomm because of this modularity.
Why does the component say I have to install the driver?
In the usbpipedemo.dpr demo program I run it with administrator rights but the driver could not be installed.

Thank you for your guidance.

Best regards

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: nrUSB.SendData show Abstract Error
« Reply #3 on: August 28, 2017, 03:05:14 am »
Hello

Thank you for your information.

TnrUSB checks device before open it over WinUSB api.
Component checks Service property of device.
WinUSB devices usual contain  'winusb' service.

Please build and run  \Demos\USBDeviceDemo\usbdevicedemo.dpr
Select your device and send to me the screenshot with device info.

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.