GEM packet format doesn't look right

Post any 3rd party software here.
Post Reply
reidfo
Posts: 3
Joined: Mon Apr 04, 2016 2:00 pm

GEM packet format doesn't look right

Post by reidfo » Wed Apr 06, 2016 3:54 pm

I'm working on writing software to monitor the GEM and have two installed that I'm testing with. Both are new and on the latest firmware. The packets I'm capturing are not matching up with the packet format described in GEM-PKT_Packet_Format_2_1.pdf. I'm using the BIN48-NET format.

I have noticed that the preamble instead of being FE FF 05 is instead FE FF FF 05. I am also seeing packet length of 622 bytes (though sometimes it is 623 for some reason). I'm not able to get the checksum to match either. Is there a newer version of the packet spec I should be looking at?

Here is a sample packet:

Code: Select all

    00000009  fe ff ff 05 04 a5 bd ab  3d 00 00 4e 80 d0 2f 00   ........ =..N../.
    00000019  f5 bc d6 09 00 34 7d d0  04 00 01 00 00 00 00 01   .....4}. ........
    00000029  00 00 00 00 00 00 00 00  00 29 4a 00 00 00 9b 55   ........ .)J....U
    00000039  30 00 00 03 00 00 00 00  6f 6b 78 07 00 5d d5 e8   0....... okx..]..
    00000049  01 00 3d d5 30 02 00 95  f5 14 00 00 00 00 00 00   ..=.0... ........
    00000059  00 0e 00 00 00 00 63 31  46 01 00 f3 45 62 00 00   ......c1 F...Eb..
    00000069  00 00 00 00 00 4b 00 00  00 00 c5 9c 02 00 00 50   .....K.. .......P
    00000079  25 00 00 00 8f 9a 02 00  00 a1 26 13 11 00 94 80   %....... ..&.....
    00000089  22 00 00 9d 88 69 02 00  47 9c 2f 00 00 01 00 00   "....i.. G./.....
    00000099  00 00 23 00 00 00 00 72  b4 03 00 00 eb 36 01 00   ..#....r .....6..
    000000A9  00 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000000B9  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000000C9  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000000D9  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000000E9  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000000F9  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    00000109  00                                                 .
    0000010A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000011A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000012A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000013A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000014A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000015A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000016A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000017A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000018A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    0000019A  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000001AA  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000001BA  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000001CA  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000001DA  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
    000001EA  00 00 00 00 00 01 4d 00  0b 01 00 39 03 5b 00 58   ......M. ...9.[.X
    000001FA  00 00 00 00 00 00 00 01  00 00 00 00 00 b7 00 5b   ........ .......[
    0000020A  00 42 00 03 00 00 00 00  00 29 00 00 00 00 00 00   .B...... .)......
    0000021A  00 00 00 00 00 00 00 58  01 03 00 3c 00 00 00 00   .......X ...<....
    0000022A  00 00 00 01 00 00 00 00  00 00 a3 03 83 81 81 82   ........ ........
    0000023A  82 07 0b 82 82 81 a9 03  83 00 a3 03 83 81 81 00   ........ ........
    0000024A  12 00 80 37 80 03 de 1a  01 8f b0 05 00 00 00 00   ...7.... ........
    0000025A  00 00 00 00 00 00 00 00  00 7f 00 00 00 00 00 00   ........ ........
    0000026A  00 00 00 00 00 00 00 00  ff ff fe ae               ........ ....
ben
Site Admin
Posts: 4254
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM packet format doesn't look right

Post by ben » Thu Apr 07, 2016 9:55 am

Do you have the same issues with Bin-48-NET-Time?

Are these errors all the time or intermittent?
Ben
Brultech Research Inc.
E: ben(at)brultech.com
reidfo
Posts: 3
Joined: Mon Apr 04, 2016 2:00 pm

Re: GEM packet format doesn't look right

Post by reidfo » Thu Apr 07, 2016 12:58 pm

I have the same issue with all binary formats. I failed to mention that I was connecting to a serial to ethernet converter (Digi PortServer TS) raw socket. I just got my serial code completed and connected using serial (still through the Digi) instead of TCP and the packets look fine now with one minor exception. The checksum that I am calculating is higher than the one reported, always by a value of 1.

To compute the checksum I am summing the values of all bytes minus the first three and the last three in the packet, then taking the lowest byte. Am I calculating incorrectly?
ben
Site Admin
Posts: 4254
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM packet format doesn't look right

Post by ben » Fri Apr 08, 2016 9:53 am

reidfo wrote:I have the same issue with all binary formats. I failed to mention that I was connecting to a serial to ethernet converter (Digi PortServer TS) raw socket. I just got my serial code completed and connected using serial (still through the Digi) instead of TCP and the packets look fine now with one minor exception. The checksum that I am calculating is higher than the one reported, always by a value of 1.

To compute the checksum I am summing the values of all bytes minus the first three and the last three in the packet, then taking the lowest byte. Am I calculating incorrectly?
Add the header/footer bytes in, here's an example (as per mwalls code http://lancet.mit.edu/mwall/projects/po ... n/btmon.py)

def _calculate_checksum(self, packet, devid):
"""calculate the packet checksum"""
checksum = self.START_HEADER0
checksum += self.START_HEADER1
checksum += devid
checksum += sum(packet)
checksum += self.END_HEADER0
checksum += self.END_HEADER1
return checksum & 0xff
Ben
Brultech Research Inc.
E: ben(at)brultech.com
reidfo
Posts: 3
Joined: Mon Apr 04, 2016 2:00 pm

Re: GEM packet format doesn't look right

Post by reidfo » Fri Apr 08, 2016 12:13 pm

Great, thank you for the clarification. Checksums match now, and I figured out the issue with the network packets getting mangled. All is good now!
Post Reply