Hello,
I’m trying to send data to a device but I get a System.Exception from GHIElectronics.NETMF.USBHost.dll 
The data to be sent is this one :
SetupPacket:
0000: 22 09 00 02 00 00 00 00
bmRequestType: 22
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Endpoint
bRequest: 09
TransferBuffer: 0x00000004 (4) length
0000: 80 00 00 01
My code is this one :
OutputData[0] = 0x80;
OutputData[1] = 0x00;
OutputData[2] = 0x00;
OutputData[3] = 0x01;
_IF1018.SendSetupTransfer(0x22, 0x09, 0x0002, 0x0000, OutputData, 0, 4);
//_IF1018.SendSetupTransfer(0x22, 0x09, 0x00, 0x02, OutputData, 0, 4);
None of this works…
What am I doing wrong ?
Any help would be welcome here.
Best regards,
Christophe
This is little endian, you need to switch the bytes order:
_IF1018.SendSetupTransfer(0x22, 0x09, 0x0200, 0x0000, OutputData, 0, 4);
Doesn’t work either 
#### Exception System.Exception - 0xffffffff (4) ####
#### GHIElectronics.NETMF.USBHost.USBH_RawDevice::SendSetupTransfer [IP: 0000] ####
#### FEZPhidgets.IF1018::Output [IP: 0038] ####
#### MFConsoleApplication1.Program::Phidget1018_InputChange [IP: 003f] ####
#### FEZPhidgets.IF1018::GetInputs [IP: 0055] ####
#### FEZPhidgets.IF1018::_1018Thread [IP: 0083] ####
A first chance exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
An unhandled exception of type 'System.Exception' occurred in GHIElectronics.NETMF.USBHost.dll
If it can help, here’s the report from USBView :
Device Descriptor:
bcdUSB: 0x0110
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x06C2
idProduct: 0x0045
bcdDevice: 0x081A
iManufacturer: 0x01
0x0409: "Phidgets Inc."
iProduct: 0x02
0x0409: "PhidgetInterfaceKit"
iSerialNumber: 0x03
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Low
Device Address: 0x02
Open Pipes: 1
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x08
Configuration Descriptor:
wTotalLength: 0x0022
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 (Bus Powered )
MaxPower: 0xFA (500 Ma)
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x03 (HID)
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00
HID Descriptor:
bcdHID: 0x0110
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x0020
Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x08
There’s nothing weird in this report, to me. Only one endpoint, only one pipe.
The USB Frame shown in my first post was captured by a sniffer. I know that this frame was the one I wanted to send because it is the only one that contains the value(s) that I know are being modified.
Here, the 0x80 in the transfer buffer represents a binary 10000000, which means that the Digital Output #7 is “on”, while the others are “off”.
I’ve just figured it out 
bmRequestType should be 0x21, not 0x22…
_IF1018.SendSetupTransfer(0x21, 0x09, 0x02, 0x00, OutputData, 0, 4);
Now it’s working almost like a charm 
Here’s a video showing the use of the digital outputs on the Phidgets 1018 board :
http://www.lsp-fr.com/FEZ/DSCN0671.avi (20 MB)
Setup :
- the push button is on a digital input of the 1018
- this button turns on a led on the 1018 and the one on the FEZ Domino
- the LDR button on the FEZ Domino turns off both leds
With this driver, I can now easily add 8 digital IO and 8 analog inputs to the FEZ Domino 
Usage is very simple, as usual.
For example, this code snippet shows how to turn on Phidgets 1018 Digital Output 7 (and onboard led) when Digital Input 6 state changes (button pressed). The code is placed in the user supplied event handler.
static void Phidget1018_InputChange(object sender, Phidget1018InputChangeEventArgs e)
{
if (e.Index == 6) { IF1018.Output(7, true); Led.Write(true); }
}
Thanks for all the efforts, looks great.
By the way, uploading the video to youtube makes it easier to users to watch instead of downloading 20MB
I may take your video and upload it, if that is okay with you.
[quote]I may take your video and upload it, if that is okay with you.[/quote] Yes you can 
Project is updated with your video 