I have an XSens MTi-G motion tracker and an Arduino Uno. The message structure over serial is defined as follows:
PRE = 0xFA
BID = 0xFF
MID = varies
LEN = varies
DATA = LEN bytes
CS = checksum
The baud rate is 115200 on the device and it's programmed to send a data message (MID=0x32) at a 10 Hz update rate. Using the Serial monitor sample code, I never receive the 0xFA-0xFF byte sequence. Attached to a PC, the XSens sends this sequence, but reading the serial output with the Arduino only randomly (coincidentally) receives it. Previously, a PIC-based uC was used to read the serial output and it worked fine - is there any reason the Arduino is having trouble? Here's the code I'm using:
void setup() {
Serial.begin(115200);
}
int incomingByte = 0;
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.print("S: ");
Serial.println(incomingByte, HEX);
}
}
If you're interested in the raw output it can be downloaded at
http://cl.ly/3Q0z33353w0s0z1w0J0G for analysis.