Hey all,
I am trying to do something very similar for my senior design project for school. I would appreciate any help with a problem I am having.
I am trying to interface a Telit UC864-G via usb to my FEZ Cobra.
(Module) http://www.semiconductorstore.com/cart/pc/viewPrd.asp?idproduct=43555
(Interface board I am using) http://www.semiconductorstore.com/cart/pc/viewPrd.asp?idproduct=42899
I have read all of the hardware and software datasheets for the module and am fairly certain that I have it hooked up correctly. It works pretty well when connected to my pc using their proprietary drivers. What I am less certain of is writing my own custom driver to allow interfacing with my Cobra.
In the datasheet it says there are 4 serial interfaces to the modem available via usb. This seems correct because when the device is connected to my windows PC using their proprietary drivers there are 4 new devices in device manager: 3 serial ports and 1 modem.
The devices are the following:
MODEM USB SERIAL PORT
AUX USB SERIAL PORT
NMEA USB SERIAL PORT
DIAGNOSTICS INTERFACE SERIAL PORT
To start off I examined the output of this program, which seems to me immensely helpful
http://www.fezzer.com/project/164/usb-discovery-helper/
The output is listed below, and I think I have identified the various different devices by observing their hardware profiles on my PC versus the output of this program:
[quote][Device, Port 0]
Type: Unknown
ProductID: 4100
VendorID: 7111
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 0 italic[/italic]
Protocol: 255
Type: 4
– Endpoint –
Attributes: 3
Address: 129
Type: 5
Interval: 128
– Endpoint –
Attributes: 2
Address: 130
Type: 5
Interval: 0
– Endpoint –
Attributes: 2
Address: 2
Type: 5
Interval: 0
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 1 [italic](DIAGNOSTICS INTERFACE)[/italic]
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 132
Type: 5
Interval: 0
– Endpoint –
Attributes: 2
Address: 4
Type: 5
Interval: 0
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 2 [italic](NMEA PORT)[/italic]
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 133
Type: 5
Interval: 0
– Endpoint –
Attributes: 2
Address: 5
Type: 5
Interval: 0
=== Interface ===
Class: Vendor Specific
SubClass: 255
Number: 3 [italic](AUXILLIARY PORT)[/italic]
Protocol: 255
Type: 4
– Endpoint –
Attributes: 2
Address: 131
Type: 5
Interval: 0
– Endpoint –
Attributes: 2
Address: 3
Type: 5
Interval: 0[/quote]
Now down to my problem:
I cannot seem to isolate those serial interfaces. I do not have a ton of experience writing drivers for USB devices, but my code below seems like it might be close to correct from what I have read (in this thread, and other places)
namespace FEZ_Cobra_Console_Application1
{
class TelitDriver
{
USBH_RawDevice controller;
USBH_Device modemModule;
USBH_SerialUSB modemSerial;
USBH_Device nmeaReadings; //GPS, in NMEA Format
USBH_SerialUSB nmeaSerial;
//USBH_Device diagnosticInterface;
//USBH_Device auxilliaryPort;
public TelitDriver()
{
USBHostController.DeviceConnectedEvent += DeviceConnectedEvent;
}
void DeviceConnectedEvent(USBH_Device device)
{
Debug.Print("[Device, Port " + device.PORT_NUMBER + "], ID: " + device.ID);
controller = new USBH_RawDevice(device);
//Debug.Print("Type: " + DeviceTypeToString(device.TYPE));
Debug.Print("ProductID: " + controller.PRODUCT_ID);
Debug.Print("VendorID: " + controller.VENDOR_ID);
//dont need to verify types of anything because I am only using this device for now
try
{
if (nmeaReadings == null)
{
nmeaReadings = new USBH_Device(device.ID, 2, device.TYPE, 7111, 4100, 0);
nmeaSerial = new USBH_SerialUSB(nmeaReadings, 9600, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
}
if (modemModule == null)
{
modemModule = new USBH_Device(device.ID, 0, device.TYPE, 7111, 4100, 0);
modemSerial = new USBH_SerialUSB(modemModule, 115200, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
}
//Cannot get past this point to go ahead and initialize the modem, as in the PPP example online
}
catch (Exception ea)
{
Debug.Print("Problem initializing USB Modem: " + ea.Message);
}
}
}
}
I keep getting exceptions when I try and make the serial port object. Does anyone have any idea what step I am missing here? Maybe it is appropriate to send something to the interfaces before I initialize the port? If so, what is that typically?
Any help is appreciated. Thanks