paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] Paparazzi modem protocol - checksum help


From: Greg Jones
Subject: Re: [Paparazzi-devel] Paparazzi modem protocol - checksum help
Date: Mon, 17 May 2010 00:31:18 +0100

Poine,

Of course! Perfect - that's much more like it.

By the way I don't suppose you're familiar with the 'valim' telemetry
message, its part of the MODEM_STATUS collection. Is it related to
audio? It seems a little kludged in the source code.

Thanks very much for the assistance

Greg

if you like C better, you can find the C implementation of said
checksum in sw/airborne/pprz_transport.h

Regards

Poine

On Sun, May 16, 2010 at 11:14 PM, Greg Jones
<address@hidden> wrote:
> Hi,
>
> I have been trying to implement the checksum applied to messages
> transmitted using the Paparazzi protocol (as opposed to the XBee
> protocol.)
>
> The Checksum detailed in 'modem.ml' looks relatively simple and seems
to
> XOR the contents of the message and inserts this value into the last
but
> one packet of each message.
>
> However I must be missing something as I cannot correctly compute this
> checksum - could somebody who understands the checksum or OCAML please
> give me a clue what the following code extract is doing?
>
> let checksum = fun msg ->
>    let l = String.length msg in
>    let ck_a = ref 0 in
>    for i = 1 to l - 3 do
>      ck_a := Char.code msg.[i] lxor !ck_a
>    done;
>    !ck_a = Char.code msg.[l-2] && Char.code msg.[l-1] = etx
>
>
> My code tries to replicate the above and does the following:
>
> 1) Zero the checksum variable
> 2) Loop through STX, Length and the message XORing each byte with the
> checksum variable
> 3) Write the checksum to the message
> 4) Write the ETX (by the way what should ETX be, STX seemed to be
0x99?)
>
> Where am I going wrong? OCAML is a bit of a nightmare to the
> uninitiated.
>
> Many thanks
>
> Greg
>
> _______________________________________________
> Paparazzi-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/paparazzi-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]