Sending a Bream message to LC29D

Hi!

I’m trying to send a BRM message to a LC29D in order to get it’s configuration or change it.
I’m using the description from Quectel_LC29D_GNSS_Protocol_Specification_V1.0.pdf

However, I don’t get any response, ACK or NACK.
For example, I send “BRM-STP-MESSAGE - Set Message Rate”

Write B56206010300F00401F5D9
b'$GNGNS,013531.00,,,,,NNNNNN,00,99.0,,,,,V*1C\r\n'
b'$GNRMC,013531.00,V,,,,,,,010712,,,N,V*19\r\n'
b'$GNGNS,013532.00,,,,,NNNNNN,00,99.0,,,,,V*1F\r\n'
b'$GNRMC,013532.00,V,,,,,,,010712,,,N,V*1A\r\n'

I suspect my checksum algorithm is wrong. In the document:

//Buffer is the data array of which the checksum needs to be calculated.
uint8_t CHK1 = 0;
uint8_t CHK2 = 0;
for(i = 0; i < length; i++)
{
CHK1 = CHK1 + Buffer[i];
CHK2 = CHK2 + CHK1;
}

I implemented this algorithm and for me it gives:

byte = f0, chk1 = f0, chk2 = f0
byte = 04, chk1 = f4, chk2 = e4
byte = 01, chk1 = f5, chk2 = d9

It is different than checksum in QGNSS 1.5.2.
What should be the correct algorithm for the checksum?

My device FW version:

$PQTMGNSS,001*0C
$PQTMVER,MODULE_LC29DCNR01A01S_2WDR_HYF,2021/04/25,13:49:04*10
$PQTMVER,SUB_V02*3A
$PQTMVER,QL_SDK_V1.1.4,2021/04/25,13:49:04*5F
$PQTMSWCONFIG,1,1,17,55AA55AAC61BE69C000000000001FFFF00000000D9D8DA00640000000000000090D003000101640202010000010000000000000058595A000000000000000000*11
$PQTMSWCONFIG,1,2,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*13
$PQTMSWCONFIG,1,3,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*12
$PQTMSWCONFIG,1,4,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*15
$PQTMSWCONFIG,1,5,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*14
$PQTMSWCONFIG,1,6,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*17
$PQTMSWCONFIG,1,7,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*16
$PQTMSWCONFIG,1,8,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*19
$PQTMSWCONFIG,1,9,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*18
$PQTMSWCONFIG,1,10,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*20
$PQTMSWCONFIG,1,11,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*21
$PQTMSWCONFIG,1,12,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*22
$PQTMSWCONFIG,1,13,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*23
$PQTMSWCONFIG,1,14,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*24
$PQTMSWCONFIG,1,15,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*25
$PQTMSWCONFIG,1,16,17,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*26
$PQTMSWCONFIG,1,17,17,000000000000000000000000000000000000000000000000000000000000000000000000*27
$PQTMIMUTYPE,2*4F

Dear Sir
1.The checksum of the hexadecimal command is in the following way.
//Buffer is the data array of which the checksum needs to be calculated.
uint8_t CHK1 = 0;
uint8_t CHK2 = 0;
for(i = 0; i < length; i++)
{
CHK1 = CHK1 + Buffer[i];
CHK2 = CHK2 + CHK1;
}
2.The checksum of NMEA format is calculated by XOR, which is different from the hexadecimal method.
3.The output frequency can only be 0 and 1,0 means no output, 1 means 1hz output.

Hi Albert, thank you for confirmation.

The problem is that the checksum computed with the hexadecimal algorithm for BRM is different than what I get in QGNSS, and the LC29D module does not respond to my message.

This means the algorithm in the PDF is not correct for BRM messages.

In QGNSS: B5 62 06 01 03 00 F0 04 01 FF 18
Payload:

F0 04 01

Checksum

FF 18

In my program (using the attached CHK1 CHK2 algorithm): B56206010300F00401F5D9

Payload

F0 04 01

Checksum

F5 D9

Attached program output:

Compute checksum for payload F00401, chk1 = 00, chk2 = 00
byte = F0, chk1 = F0, chk2 = F0
byte = 04, chk1 = F4, chk2 = E4
byte = 01, chk1 = F5, chk2 = D9

In QGNSS Quectel tool:

Program for reference - minimal working example. You can run it and see that it gives different output than QGNSS.

#include <stdio.h>
#include <stdint.h>

int main(void)
{
    unsigned int length = 3;
    uint8_t Buffer[3] = {0xF0, 0x04, 0x01};

    //Buffer is the data array of which the checksum needs to be calculated.
    uint8_t CHK1 = 0;
    uint8_t CHK2 = 0;
    for(size_t i = 0; i < length; i++)
    {
    CHK1 = CHK1 + Buffer[i];
    CHK2 = CHK2 + CHK1;

    printf("byte = %02X, chk1 = %02X, chk2 = %02X\n",
            Buffer[i], CHK1, CHK2);
    }
}

Dear Sir
The checksum calculation range is shown in the figure below. Your calculation is missing 4 bytes.Thanks!

Dear Albert,

Thank you for help - problem solved.
The calculation is correct when you take whole range as payload:

byte = 06, chk1 = 06, chk2 = 06
byte = 01, chk1 = 07, chk2 = 0D
byte = 03, chk1 = 0A, chk2 = 17
byte = 00, chk1 = 0A, chk2 = 21
byte = F0, chk1 = FA, chk2 = 1B
byte = 04, chk1 = FE, chk2 = 19
byte = 01, chk1 = FF, chk2 = 18
Write B56206010300F00401FF18

Also the module responds with BRM-ACK-ACK.

You are great! come on!