Temperature and RPM is OK, but I am now trying to connect a GlobalSat BR-355 GPS receiver to COM1 on the NetDuino+. Unfortunately I only receive garbled data.
I have checked the settings of the port, and I believe it is OK. I have installed an old PC as an eaves-dropper on the serial data line and I log the following (correct – GPS has no fix) data starting with GPS power up:
$PSRFTXT,Version:GSW3.5.0_3.5.00.00-SDK-3EP2.01 *46 $PSRFTXT,Version2:F-GPS-03-1006231*2A $PSRFTXT,WAAS Enable*66 $PSRFTXT,TOW: 58582*27 $PSRFTXT,WK: 1674*61 $PSRFTXT,POS: 3514706 779953 5247342*10 $PSRFTXT,CLK: 95996*27 $PSRFTXT,CHNL: 12*73 $PSRFTXT,Baud rate: 4800*65 $GPGGA,161851.213,,,,,0,00,,,M,0.0,M,,0000*5C $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161851.213,V,,,,,,,050212,,,N*43 $GPGGA,161852.150,,,,,0,00,,,M,0.0,M,,0000*5B $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161852.150,V,,,,,,,050212,,,N*44 $GPGGA,161853.150,,,,,0,00,,,M,0.0,M,,0000*5A $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161853.150,V,,,,,,,050212,,,N*45 $GPGGA,161854.150,,,,,0,00,,,M,0.0,M,,0000*5D $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161854.150,V,,,,,,,050212,,,N*42 $GPGGA,161855.150,,,,,0,00,,,M,0.0,M,,0000*5C $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPGSV,3,1,12,07,71,104,,13,38,087,,16,15,030,,23,10,092,34*76 $GPGSV,3,2,12,10,55,172,,08,55,193,,05,49,291,,02,22,237,*7B $GPGSV,3,3,12,26,16,269,,04,06,207,,06,03,044,,03,03,057,*74 $GPRMC,161855.150,V,,,,,,,050212,,,N*43 $GPGGA,161856.150,,,,,0,00,,,M,0.0,M,,0000*5F $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161856.150,V,,,,,,,050212,,,N*40 $GPGGA,161857.150,,,,,0,00,,,M,0.0,M,,0000*5E $GPGSA,A,1,,,,,,,,,,,,,,,*1E $GPRMC,161857.150,V,,,,,,,050212,,,N*41 $GPGGA,161858.150,,,,,0,00,,,M,0.0,M,,0000*51 $GPGSA,A,1,,,,,,,,,,,,,,,*1E
But when I read it from the serial port on the ND+ I get the following bytes (not the same as above):
155 92 37 137 233 57 211 102 166 166 153 230 153 52 101 99 153 154 101 101 153 102 52 101 103 101 153 154 44 154 166 102 38 230 102 51 166 204 76 204 154 93 154 230 154 38 230 154 102 204 52 101 154 89 154 153 103 52 101 154 89 154 154 230 230 230 102 205 153 151 121 61 155 92 37 165 57 211 57 211 230 154 51 102 154 103 102 154 103 50 154 154 154 154 154 154 154 154 154 154 154 154 53 103 95 121 61 155 92 101 150 94 154 103 50 103 101 230 153 52 101 99 153 154 42 154 101 101 153 102 52 101 103 101 153 154 44 154 166 102 38 230 102 51 166 204 76 204 154 93 154 154 154 166 153 102 166 102 230 154 154 154 44 53 100 103 121 61 155 92 37 137 233 57 211 102 166 166 153 166 153 52 101 99 153 154 101 101 153 102 52 101 102 102 101 154 44 154 166 102 38 230 102 19 166 230 76 230 93 154 230 154 38 230 154 154 102 204 52 101 154 89 154 153 103 52 101 154 89 154 154 230 230 230 102 205 95 121 61 155 92 37 165 57 211 57 211 230 154 51 102 154 103 102 154 103 50 154 154 154 154 154 154 154 154 154 154 154 154 53 103 95 121 61 155 92 101 150 94 154 103 50 103 101 166 153 52 101 99 153 154 42 154 101 101 153 102 52 101 102 102 101 154 44 154 166 102 38 230 102 19 166 230 76 230 154 93 154 154 154 166 153 102 166 102 230 154 154 154 44 53 100 50 121 61 155 92 37 137 233 57 211 102 166 166 153 102 102 83 166 204 153 154 101 101 153 102 52 101 103 102 204 154 44 154 166 102 38 230 102 51 38 230 166 204 154 93 154 230 154 38 230 154 102 204 52 101 154 89 154 153 103 52 101 154 89 154 154 230 230 230 102 205 153 102 121 61 155 92 37 165 57 211 57 211 230 154 51 102 154 103 102 154 103 50 154 154 154 154 154 154 154 154 154 154 154 154 53 103 95 121 61 155 92 101 150 94 154 103 50 103 101 102 102 83 166 204 153 154 42 154 101 101 153 102 52 101 103 102 204 154 44 154 166 102 38 230 102 51 38
Many of the received characters are greater than 127, which is incorrect and the reason why (I guess) I cannot use the encoding without exceptions.
More info: The GPS is powered from the ND+’s 5 volt. I experimented quite a bit with baud rates, stop bits, timeouts, data bits etc., but no luck.
Here is my code:
namespace Serial_Port_test { public class Constants{ public const int MaxVal = 40; } public class Program { static SerialPort com; static byte[] ByteBuffer = new byte[Constants.MaxVal]; static int index = 0; public static void Main() { com = new SerialPort(SerialPorts.COM1, 4800, Parity.None, 8, StopBits.One); com.DataReceived += new SerialDataReceivedEventHandler(com_DataReceived); com.Handshake = Handshake.None; com.Open(); Thread.Sleep(Timeout.Infinite); } static void com_DataReceived(object sender, SerialDataReceivedEventArgs e) { byte[] bytes = new byte[1]; com.Read(bytes, 0, bytes.Length); ByteBuffer[index++] = bytes[0]; if (index >= Constants.MaxVal) { string line =""; for (int i = 0; i < Constants.MaxVal; i++) { line = line + " " + ByteBuffer[i].ToString(); } Debug.Print(line); index = 0; } } } }
Any ideas as to what could be the problem?
Best regards,
Kristian
Copenhagen