1 Reply Latest reply on Aug 9, 2019 5:43 AM by DheerajK_81

    CheckSum_from_rom incorrect in implementation of SelfTest_FlashCheckSum (Class B Safety Software Library)

    DeHo_722036

      I've been implementing BIT tests using the Class B Safety Software Library and AN78175 (attached) as a reference. Most have been fairly straightforward. But I'm having difficulty with SelfTest_FlashCheckSum(). As the instructions in the AN direct (see below), I first build the project in PSoC Creator with the stored checksum value set to 0x0000 in the SelfTest_Flash.c file. I then open PSoC Programmer and read Flashchecksum. I copy that value and replace the previous value in code (0x0000) with the new value and compile the project and program PSoC.
      Screen Shot 2019-08-03 at 4.28.53 PM.png
      The issue I'm having is that at the end of the flash, after the code has calculated and accumulated a checksum value, it ultimately compares that calculated checksum (checkSum_rom) with the checksum stored in ROM in the steps above (CheckSum_from_rom). But... CheckSum_from_rom isn't initialized to the value I provided in the initial steps. It instead seems to ALWAYS have the same value (0x8000). What gives? What am I doing wrong? And why doesn't CheckSum_from_rom ever reflect the value I provided in line 79 (0x683F)?

       

      Screen Shot 2019-08-03 at 4.15.57 PM.png

       

      Screen Shot 2019-08-03 at 4.17.16 PM.png

       

      I'm going to assume that I'm just doing something wrong, but I can't for the life of me figure out what that is. Any help would be greatly appreciated.

       

      Message was edited by: Denver Hopkins A day later and with fresh eyes, I had a eureka moment when I realized I'd not noticed a comment in the header for function SelfTest_FlashCheckSum() which says, "SelfTest_FlashCheckSum_Init() must be called one time before this function to store flash checksum in to EEPROM after first device start." Not calling that function seems like an obvious cause of my issue. However, I've searched the Class B Saftety Software Library and can't find the function SelfTest_FlashCheckSum_Init() anywhere. I've since decided to use the ECC method to test Flash, but would still like to understand why the Checksum method isn't working.