i use serial communication between arduino mega and netduino
the data i receive is fragmented or merged also sometimes corrupted
a packet dump which were sent by the mega
Packet length : 8
Packet destination : netduino
Packet source : mega
Packet Type : Ping
Packet CheckSum : 11
0x8, 0x1, 0x2, 0x0, 0xB, 0x0, 0x0, 0x00 218 701 713 195 82 518 1023 833 583 367 799 1023 736 343 500
Packet length : 72
Packet destination : netduino
Packet source : mega
Packet Type : Analog update
Packet CheckSum : 2335
0x48, 0x1, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0xDA, 0x0, 0x0, 0x0, 0xBD, 0x2, 0x0, 0x0,
0xC9, 0x2, 0x0, 0x0, 0xC3, 0x0, 0x0, 0x0, 0x52, 0x0, 0x0, 0x0, 0x6, 0x2, 0x0, 0x0,
0xFF, 0x3, 0x0, 0x0, 0x41, 0x3, 0x0, 0x0, 0x47, 0x2, 0x0, 0x0, 0x6F, 0x1, 0x0, 0x0,
0x1F, 0x3, 0x0, 0x0, 0xFF, 0x3, 0x0, 0x0, 0xE0, 0x2, 0x0, 0x0, 0x57, 0x1, 0x0, 0x0,
0xF4, 0x1, 0x0, 0x0, 0x1F, 0x9, 0x0, 0x0
an example of what i recieve
[06/01/2011 00:00:11 Undetermined->Undetermined]Packet Length : 72 From : 2 To : 1 with type : 1 and actual len : 82
[06/01/2011 00:00:12 Undetermined->Undetermined] 0x48 0x01 0x02 0x01 0x82 0x02 0x00 0x00 0x79 0x02 0x00 0x00 0x81 0x02 0x00 0x00 0x46 0x02 0x00 0x00 0x1E 0x02 0x00 0x00 0xFE 0x01 0x00 0x00 0xE9 0x01 0x00 0x00 0xC0 0x02 0x00 0x00 0x0F 0x03 0x00 0x00 0x49 0x03 0x00 0x00 0xC1 0x02 0x00 0x00 0x93 0x02 0x00 0x00 0xAF 0x02 0x00 0x00 0x96 0x02 0x00 0x00 0x82 0x02 0x00 0x00 0x4A 0x02 0x00 0x00 0xB0 0x08 0x00 0x00
[06/01/2011 00:00:16 Undetermined->Undetermined]Packet Length : 72 From : 2 To : 1 with type : 1 and actual len : 50
[06/01/2011 00:00:16 Undetermined->Undetermined] 0x48 0x01 0x02 0x01 0x07 0x02 0x00 0x00 0x0F 0x02 0x00 0x00 0x04 0x02 0x00 0x00 0x43 0x02 0x00 0x00 0x48 0x02 0x00 0x00 0xD3 0x01 0x00 0x00 0xC5 0x01 0x00 0x00 0x97 0x02 0x00 0x00 0xFD 0x02 0x00 0x00 0x3D 0x03 0x00 0x00 0x06 0x03 0x00 0x00 0x0D 0x03
[06/01/2011 00:00:16 Undetermined->Undetermined]Packet Length : 0 From : 26 To : 0 with type : 3 and actual len : 32
[06/01/2011 00:00:16 Undetermined->Undetermined] 0x00 0x00 0x1A 0x03 0x00 0x00 0xDC 0x02 0x00 0x00 0x0A 0x03 0x00 0x00 0x23 0x03 0x00 0x00 0xB4 0x05 0x00 0x00 0x08 0x01 0x02 0x00 0x0B 0x00 0x00 0x00 0x0D 0x0A
[06/01/2011 00:00:21 Undetermined->Undetermined]Packet Length : 72 From : 2 To : 1 with type : 1 and actual len : 46
[06/01/2011 00:00:21 Undetermined->Undetermined] 0x48 0x01 0x02 0x01 0x21 0x02 0x00 0x00 0x19 0x02 0x00 0x00 0xFC 0x01 0x00 0x00 0x27 0x02 0x00 0x00 0xBB 0x01 0x00 0x00 0x98 0x01 0x00 0x00 0x80 0x01 0x00 0x00 0x43 0x02 0x00 0x00 0x9F 0x02 0x00 0x00 0xF7 0x02 0x00 0x00 0x51 0x02
[06/01/2011 00:00:21 Undetermined->Undetermined]Packet Length : 0 From : 35 To : 0 with type : 2 and actual len : 36
[06/01/2011 00:00:21 Undetermined->Undetermined] 0x00 0x00 0x23 0x02 0x00 0x00 0x1C 0x02 0x00 0x00 0xC9 0x01 0x00 0x00 0xE8 0x01 0x00 0x00 0xC9 0x01 0x00 0x00 0x78 0x08 0x00 0x00 0x08 0x01 0x02 0x00 0x0B 0x00 0x00 0x00 0x0D 0x0A
[06/01/2011 00:00:26 Undetermined->Undetermined]Packet Length : 72 From : 2 To : 1 with type : 1 and actual len : 82
[06/01/2011 00:00:26 Undetermined->Undetermined] 0x48 0x01 0x02 0x01 0x0F 0x02 0x00 0x00 0x43 0x02 0x00 0x00 0x36 0x02 0x00 0x00 0x0C 0x02 0x00 0x00 0xFD 0x01 0x00 0x00 0xE0 0x01 0x00 0x00 0xD4 0x01 0x00 0x00 0xA8 0x02 0x00 0x00 0x1D 0x03 0x00 0x00 0x40 0x03 0x00 0x00 0x0A 0x03 0x00 0x00 0xFD 0x02 0x00 0x00 0x20 0x03 0x00 0x00 0xE8 0x02 0x00 0x00 0x17 0x03 0x00 0x00 0x2C 0x03 0x00 0x00 0x0B 0x07 0x00 0x00 0x08 0x01 0x02 0x00 0x0B 0x00 0x00 0x00 0x0D 0x0A
notice that at the first packet i receive the packet is pretty much fine but i've 10 extra bytes
notice the second packet were i received only 50 bytes where i was supposed to recieve 72 but merging it with the third packet that makes 2 full packets of 72 and 8 with 2 extra bytes in the end