Main Site Documentation

Updating my GPS's Baud and Update Rate


#1

OK,

I have my GPS and 6DOF boards reading and logging to the SD card on my Domino. Lots of fun and pretty.

Now I want to write to the GPS to increase the update rate (which also requires a baud increase). The format is SkyTrac Binary. There is a link to the reference below which indicates a binary/hex message format.

I have a bunch of conceptual questions that hopefully someone can answer:
[ulist]what format am I writing back in Char/byte/string? Not understanding how I send a HEX character I guess.
when I change the baud rate I assume I need to close and then reopen the connection? how do I even get the ACK back if the baud has changed :slight_smile:
any sample code would be helpful - I have looked around but not found any
[/ulist]

Thanks for all the great help so far!

http://www.sparkfun.com/datasheets/GPS/Modules/AN0003_v1.4.14_FlashOnly.pdf


#2

With the serial port you are sending an array of bytes. A byte can have a value of 0.255. Checkout the documentation for SerialPort class.


#3

I read the C# documentation…are you referring to something else?

Serial Port has three write methods - string, byte and char.

are you saying that I can pass it a string and it will automatically cast/convert it to bytes and then send bytes? That would be cool - but its not clear that this is what happens in the docs to me.

http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx


#4

Read the ebook. The example shows you exactly how to do it.

95% of a beginners questions are answered in the book.


#5

You could also just use the skytraq PC interface application to set the device up, then simply commit the settings to EEPROM.

BTW: Make sure to use a 3.3V LVTTL cable. The Skytraq chipset will fry with anything more than 3.3V.


#6

I have read the eBook about 4 times - it is really awesome at getting the high level concepts down…

This being said - there is nothing in the eBook that explains the difference between:

[ulist]Write(String) Writes the specified string to the serial port.
Write(Byte[], Int32, Int32) Writes a specified number of bytes to the serial port using data from a buffer.
Write(Char[], Int32, Int32) Writes a specified number of characters to the serial port using data from a buffer. [/ulist]

And under what circumstances to use each.

What I am hearing you say is ‘Just use Byte Arrays’ - Putting Chars and Strings through a Serial port is stupid.

As for the PC interface - I wanted to make something a little more robust that could check the rates and update them if they ‘get off spec’.


#7

Values stored in EEPROM will not be erased or “drift off spec”.


#8

[quote][Write(String) vs Write(Char[], Int32, Int32)]

And under what circumstances to use each.[/quote]
It’s like the difference between the number 10 and the roman numeral X. Or hex 0x0A. They’re just different ways of representing the exact same data.

If your code has a string that it wants to stuff into the serial port, you’d use the Write(string) version. If it happened to have an array of chars instead, the Write (char[], …) version would be the one to use.

Underneath, the different versions of Write are pretty much identical. They’re just starting with different ways of identifying the same stream of bytes.