• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 16, 2024, 04:12:40 am

News:

SMF - Just Installed!


nrUSB.SendData show Abstract Error

Started by epareja2, August 27, 2017, 02:50:48 am

Previous topic - Next topic

epareja2

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.

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

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

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

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

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.