Rom Bootloader WriteMemory Command CRC16 calculation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rom Bootloader WriteMemory Command CRC16 calculation

59 Views
Noay
Contributor I

I'm currently trying to program a KL17 microcontroller using another microcontroller and the KL17's built in UART ROM bootloader. I got pinging and erasing done, at least on the paper, but I'm struggling with writing data to the KL17. The example in the datasheet (page 43) says that for those bytes (framing packet,  excluding CRC16 bytes + memory write command packet):  

0x5A, 0xA4, 0x0C, 0x00, 0x04, 0x00 , 0x00, 0x02, 0x00, 0x04, 0x00, 0x20, 0x64, 0x00, 0x00, 0x00

 the CRC16 bytes would be 0x06 0x5A. However the CRC16 algorithm provided on page 27 outputs 0x2b 0x56 for me. I've also tried various CRC16 calculators online with many different variants of CRC16 calculation but none of them gave me 0x06 0x5A.

Noay_0-1790003799652.pngNoay_0-1790003799652.png


My assumption is that I'm either missing bytes that must be included into the caluclation (I wouldn't know which since the data packets following afterwards all got their own CRC16 bytes) or that someone just messed up the datasheet (which is also unlikely because this example is also exactly like that in the KL17 Sub-Family Reference Manual). 

0 Kudos
Reply
1 Reply

Celeste_Liu
NXP Employee
NXP Employee

Hello @Noay ,

Thanks for your post. I think the "0x06 0x5A" value in the Reference Manual is incorrect and most likely a documentation issue. Based on what you provided, your CRC calculation result of "0x2B 0x56" looks correct.

You can still use blhost tool to debug Bootloader commands. The parameter "-d" will provide all communication process between Host and Target.
I have tried this function on my KL27 board, and I've attached a screenshot showing the detailed output.

Celeste_Liu_0-1790136918473.pngCeleste_Liu_0-1790136918473.png

We don't have a KL17 EVB board available, could you try the same approach on your KL17 device and see what result you get?

Apologies for the documentation mistake. I'll share this with the internal team and recommend updating the documents accordingly.

BR

Celeste

 

0 Kudos
Reply