C# serial communication with u-blox gps

user36927 picture user36927 · Nov 12, 2008 · Viewed 12.6k times · Source

I have a GPS from u-blox.com with a USB-connection and driver. The driver installs a virual COM port that pops up when you plug the USB in. Using a hyperterminal I can then watch the flow of data from the GPS.

Then I want the data in my program, not so easy...

I have implemented some methods using the serialPort class to read from the GPS, but am unsuccessful. I have programmed several serial device readers and writers before in C#, but this one stops me.

As an example, the simple code in simpleSerial will not give you anything unless you unplug and replug the USB.

Have tried reading it with matlab, which works great, but as the rest of my program that needs the GPS data is in c#, that doesn't quite fix the problem.

Is there some high level C# things going on in the serialPort class that I can circumvent? Or is there any known problems reading USB-serialports, which I assume works like my GPS?

Answer

ChrisN picture ChrisN · Nov 12, 2008

If you can communicate with the GPS using HyperTerminal then in principle there's no reason why you shouldn't be able to in C#. Are you sure you've configured the serial port correctly, particularly the baud rate, data bits, stop bits, parity, and flow control settings?

You could use SysInternals PortMon tool to look at the low-level I/O and compare how HyperTerminal and your C# program each configure the serial port. Maybe this will provide some useful information.