Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1 Forum Discussions

Level 1
Level 1
First like received First like given

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.

1 Reply
First comment on KBA First comment on blog 5 questions asked

Can you please tell me which PSoC5 device you are using? Please edit the custom linker script according to the flash size of the device. I think the issue might be related to wrong linker script.

Regarding the function, "SelfTest_FlashCheckSum_Init()" you are right, it seems to be missing or not defined or a typo. But since this is not mentioned in the AN, I think it should work without it.

Please attach your project or attach the linker script so that we get more insight into the issue.