Send waypoint to a garmin GPS

Discussion in 'Global Navigation Satellite Systems' started by Beuche, Oct 7, 2004.

  1. Beuche

    Beuche Guest

    Hello,
    I want to send waypoints from my pc to my garmin gps with grmn/grmn
    protocol.

    I know that you must send something like this:
    10 23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31 32
    33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20 20
    20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E9 10 03

    10 Start of message
    23 Waypoint record ID
    3A Number of message bytes to follow
    484F... Waypoint ID, 6 letters
    0022921C Latitude (40.17773)
    3FFA44B5 Longitude (-105.8985)
    A6199B08 Time waypoint stored (144,382,374 seconds since 12/31/89
    00:00:00), UTC
    313233.. Waypoint comment, 40 letters
    E9 Checksum
    1003 Message terminator

    But how do you calculate the checksum??
    Some one can help me please...
     
    Beuche, Oct 7, 2004
    #1
    1. Advertisements

  2. From "GARMIN GPS Interface Specification April 13, 1999", paragraph 4.1.1:

    "2's complement of the sum of all bytes from byte 1 to byte n-4" where byte 1
    is the byte following the 10 DLE (Start of Message), and byte n-4 is the byte
    immediately before the checksum.

    FYI, 2's complement of a byte is easily formed by inverting byte and adding 1.

    Regards,

    Steve


    In article <>,
    (Beuche) wrote:
    >Hello,
    >I want to send waypoints from my pc to my garmin gps with grmn/grmn
    >protocol.
    >
    >I know that you must send something like this:
    >10 23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31 32
    >33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20 20
    >20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E9 10 03
    >
    >10 Start of message
    >23 Waypoint record ID
    >3A Number of message bytes to follow
    >484F... Waypoint ID, 6 letters
    >0022921C Latitude (40.17773)
    >3FFA44B5 Longitude (-105.8985)
    >A6199B08 Time waypoint stored (144,382,374 seconds since 12/31/89
    >00:00:00), UTC
    >313233.. Waypoint comment, 40 letters
    >E9 Checksum
    >1003 Message terminator
    >
    >But how do you calculate the checksum??
    >Some one can help me please...
     
    Steve in Nevada, Oct 8, 2004
    #2
    1. Advertisements

  3. Beuche

    Beuche Guest

    (Beuche) wrote in message news:<>...
    > Hello,
    > I want to send waypoints from my pc to my garmin gps with grmn/grmn
    > protocol.
    >
    > I know that you must send something like this:
    > 10 23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31 32
    > 33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20 20
    > 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E9 10 03
    >
    > 10 Start of message
    > 23 Waypoint record ID
    > 3A Number of message bytes to follow
    > 484F... Waypoint ID, 6 letters
    > 0022921C Latitude (40.17773)
    > 3FFA44B5 Longitude (-105.8985)
    > A6199B08 Time waypoint stored (144,382,374 seconds since 12/31/89
    > 00:00:00), UTC
    > 313233.. Waypoint comment, 40 letters
    > E9 Checksum
    > 1003 Message terminator
    >
    > But how do you calculate the checksum??
    > Some one can help me please...



    If some one is interresting I know the response.
    In fact the checksum is:
    - the sum between the 2nd and the 61st element.
    - FF - "result of the sum" + 1
    - take the end byte of the result number

    In this example:
    FF - (23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31
    32 33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20
    20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20) + 1 = E9
     
    Beuche, Oct 8, 2004
    #3
  4. Beuche

    Guest

    On 7 Oct 2004 06:31:04 -0700, (Beuche) wrote:

    >Hello,
    >I want to send waypoints from my pc to my garmin gps with grmn/grmn
    >protocol.
    >
    >I know that you must send something like this:
    >10 23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31 32
    >33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20 20
    >20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E9 10 03
    >
    >10 Start of message
    >23 Waypoint record ID
    >3A Number of message bytes to follow
    >484F... Waypoint ID, 6 letters
    >0022921C Latitude (40.17773)
    >3FFA44B5 Longitude (-105.8985)
    >A6199B08 Time waypoint stored (144,382,374 seconds since 12/31/89
    >00:00:00), UTC
    >313233.. Waypoint comment, 40 letters
    >E9 Checksum
    >1003 Message terminator
    >
    >But how do you calculate the checksum??
    >Some one can help me please...



    <http://www.rahul.net/kashe/checksum/checksum.exe> -- is a
    small (20K) program that will allow you to type in your sentence and
    have the checksum calculated for you.

    I don't remember where I got it, but, if I take sentences from
    my GPSR, remove the checksum and paste the remaining text into this
    program, it consistently generates the same checksum as the GPSR does.

    The program expects data in the form of a normal sentence,
    excluding the starting $ and the final * (which appears before the
    calculated checksum). These will be provided in the final output.

    From the included example, it seems to expect something
    starting with PMGNCMD or a the equivalent Garmin-specific command,
    with the following information as comma-delimited text fields, not hex
    bytes, as you seem to be providing.

    I'm not sure exactly how much of what you show should be provided, or
    if the

    If you're interested in code to generate the checksum to
    include in a program, googling "how to calculate gps checksum" will
    lead you to plenty of examples.

    HTH
     
    , Oct 8, 2004
    #4
  5. Checksum calculation is not to straight forward for the Garmin. Below
    is some code from my GarXface C++ Library and OCX. I already have a C++
    library and OCX working for the Garmin. Please check it out at
    www.stempspft.com


    while (i < PacketLen)
    {


    //Read the data length
    b = _GetByteFromPort(bSuccess);

    if (!bSuccess)
    {
    if (m_bLoggingOn)
    {
    fprintf(f,"\nThrowing exception File = %s Line =
    %d\n",__FILE__,__LINE__);
    fflush(f);
    }


    throw CGarminGpsException(GX_ERR_COM_NO_RESPONSE,FALSE,0);
    }


    if (m_bLoggingOn)
    fprintf(f,"%d ",b);

    Buffer[i++] = b;
    cs-=b;


    //If the byte was a DLE then get another byte
    if (b==0x10)
    {
    b = _GetByteFromPort(bSuccess);

    if (!bSuccess)
    {
    if (m_bLoggingOn)
    {
    fprintf(f,"\nThrowing exception File = %s Line =
    %d\n",__FILE__,__LINE__);
    fflush(f);
    }

    throw CGarminGpsException(GX_ERR_COM_NO_RESPONSE,FALSE,0);
    }


    if (b != 0x10)
    {

    if (m_bLoggingOn)
    {
    fprintf(f,"\nThrowing exception File = %s Line =
    %d\n",__FILE__,__LINE__);
    fflush(f);
    }

    throw
    CGarminGpsException(GX_ERR_GPS_INTERNAL_PROTOCOL,FALSE,GX_EXERR_GPS_DLE_EXPECTED);


    }
    }


    Bruce Stemplewski
    www.stempsoft.com



    Beuche wrote:
    > Hello,
    > I want to send waypoints from my pc to my garmin gps with grmn/grmn
    > protocol.
    >
    > I know that you must send something like this:
    > 10 23 3A 48 4F 4D 45 20 20 00 22 92 1C 3F FA 44 B5 A6 19 9B 08 31 32
    > 33 20 53 4E 4F 57 4D 41 53 53 20 50 4C 00 20 20 20 20 20 20 20 20 20
    > 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E9 10 03
    >
    > 10 Start of message
    > 23 Waypoint record ID
    > 3A Number of message bytes to follow
    > 484F... Waypoint ID, 6 letters
    > 0022921C Latitude (40.17773)
    > 3FFA44B5 Longitude (-105.8985)
    > A6199B08 Time waypoint stored (144,382,374 seconds since 12/31/89
    > 00:00:00), UTC
    > 313233.. Waypoint comment, 40 letters
    > E9 Checksum
    > 1003 Message terminator
    >
    > But how do you calculate the checksum??
    > Some one can help me please...
     
    Bruce Stemplewski, Oct 9, 2004
    #5
  6. <> wrote in
    news:...
    > On 7 Oct 2004 06:31:04 -0700, (Beuche) wrote:
    >
    > <http://www.rahul.net/kashe/checksum/checksum.exe> -- is a
    > small (20K) program that will allow you to type in your sentence and
    > have the checksum calculated for you.
    >
    > I don't remember where I got it, but, if I take sentences from
    > my GPSR, remove the checksum and paste the remaining text into this
    > program, it consistently generates the same checksum as the GPSR does.
    >
    > The program expects data in the form of a normal sentence,
    > excluding the starting $ and the final * (which appears before the
    > calculated checksum). These will be provided in the final output.



    sorry, but your answer is going to confuse the original poster completely.
    He asked for the checksum of Garmin protocol records, but your answer is
    related to NMEA strings, and here the checksum is calculated differently!


    --

    Heinrich
    http://www.gartrip.de
    mail: new<at>gartrip.de
     
    Heinrich Pfeifer, Oct 9, 2004
    #6
  7. Ooops, your right. Saw a response on the Garmin protocol plus that is
    all I have had on the brain lately.


    Heinrich Pfeifer wrote:
    > <> wrote in
    > news:...
    >
    >>On 7 Oct 2004 06:31:04 -0700, (Beuche) wrote:
    >>
    >><http://www.rahul.net/kashe/checksum/checksum.exe> -- is a
    >>small (20K) program that will allow you to type in your sentence and
    >>have the checksum calculated for you.
    >>
    >>I don't remember where I got it, but, if I take sentences from
    >>my GPSR, remove the checksum and paste the remaining text into this
    >>program, it consistently generates the same checksum as the GPSR does.
    >>
    >>The program expects data in the form of a normal sentence,
    >>excluding the starting $ and the final * (which appears before the
    >>calculated checksum). These will be provided in the final output.

    >
    >
    >
    > sorry, but your answer is going to confuse the original poster completely.
    > He asked for the checksum of Garmin protocol records, but your answer is
    > related to NMEA strings, and here the checksum is calculated differently!
    >
    >
     
    Bruce Stemplewski, Oct 9, 2004
    #7
  8. Hi!

    if you want some code in java, please have a look at
    http://gpsmap.sourceforge.net

    there is a LGPS implementation of the garmin protocol (amongst others).

    regards
    Christof
     
    Christof Dallermassl, Oct 12, 2004
    #8
  9. Beuche

    RajanMistry1

    Joined:
    Oct 26, 2011
    Messages:
    1
    First of all,

    why is this thread not under Garmin?
    this was originally to answer any checksum issues people were facing while integrating the garmin FMI system.

    Secondly, do not get confused by any of the checksum calculators available online! and the adds people have posted! they do not solve the purpose.

    Now to solve the garmin Checksum calculation,

    This is from the GFMI development application.


    for( i = 0; i < packet->mPayloadSize; i++ )
    {
    packet->mChecksum = ( packet->mPayload + packet->mChecksum ) & 0xFF;
    }

    //the checksum is the 2's complement of all the data
    //in the packet
    packet->mChecksum = ( ( packet->mChecksum ^ 0xFF ) + 1 ) & 0xFF;

    In Layman terms,

    1. get the payload size.
    2. for i = 0 to payloadsize ,
    get each hex value in the payload and get its decimal value.
    add all the decimal values. if you are doing this in a for loop, then you will have to
    keep adding the current decimal value with the previous total.
    Keep in mind that the decimal value cant be more than 255, so if it is > 255,
    substract 256 from the current inflated value. this way the value will always be
    between 0 to 255
    3 Once you have the total of the decimal value (0 - 255), to get two's complement, substract the value from 255. then add 1. convert this decimal value to Hex value and there you have your checksum.


    Regards,
    Rajan
     
    RajanMistry1, Oct 26, 2011
    #9
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randy Rostie
    Replies:
    7
    Views:
    510
    Randy R
    Nov 2, 2004
  2. A Devrager
    Replies:
    9
    Views:
    582
    A Devrager
    May 17, 2005
  3. Peter
    Replies:
    27
    Views:
    715
    Peter
    Oct 10, 2005
  4. atcat
    Replies:
    2
    Views:
    412
    atcat
    Jan 9, 2006
  5. Andrea Palazzi

    send maps to garmin GPS without mapsource

    Andrea Palazzi, Jul 3, 2006, in forum: Global Navigation Satellite Systems
    Replies:
    22
    Views:
    1,129
    David Lee
    Jul 6, 2006
Loading...

Share This Page