So i used the new program with the one sensor and slowly started copying code and libraries over and running the program after each transfer. I also connected the rest of the I2C sensors. They all work perfectly.
Naturally, the very last piece of code I copied over is where I found the problem.
static void spComm_TransmitTelemetry() { led.Write(true); UTF8Encoding enc = new UTF8Encoding(); navData = enc.GetBytes("$TELEM," + nmea[0] + "," + nmea[1] + "," + nmea[2] + "," + nmea[3] + "," + nmea[4] + "," + nmea[5] + "," + nmea[6] + "," + nmea[7] + "," + nmea[8] + "," + nmea[9] + "," + nmea[10] + "," + nmea[11] + "," + nmea[12] + "," + nmea[13] + "rn"); //nmea[0] = UTC nmea[10] = Target Bearing //nmea[1] = Latitude nmea[11] = Temperature //nmea[2] = N/S nmea[12] = Pressure Altitude //nmea[3] = Longitude nmea[13] = Fuel Gauge //nmea[4] = E/W nmea[14] = //nmea[5] = Altitude nmea[15] = //nmea[6] = Ground Speed nmea[16] = //nmea[7] = Course nmea[17] = //nmea[8] = Date nmea[18] = //nmea[9] = Target Distance nmea[19] = //spComm.Write(navData, 0, navData.Length); Debug.Print(sensor.GetHeading().ToString()); led.Write(false); }
It seems the N+2 doesnt like my line navdata = enc.GetBytes..................
Commenting this out lets my original program run fine. Uncommenting locks it up and forces a firmware reprogramming of the N+2.
With the Netduino 1, this ran fine uncommented.
Should this be?
UPDATE (3/3/13): Its not the UTF8 encoding itself, its my data it doesnt like.
Adding this and the program runs fine. Just have to add the rest of my payload in somehow.
UTF8Encoding.UTF8.GetBytes("$TELEM", 0, 6, navData, 0);