This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR6989: Flash Integrity Check

Part Number: MSP430FR6989
Other Parts Discussed in Thread: MSP430WARE

Tool/software: Code Composer Studio

Hi,

II am working on the project and we have the requirement of Flash integrity check at every start up 

Below is the code and the project txt file 

project.txt;

u

const uint32_t addr = 0x4400

uint32_t data_Calculate_CRC(uint32_t addr, uint32_t size )
{
CRCINIRES = 0xffff;
while (size != 0)
{
CRCDI_L = _data20_read_char(addr);
++addr;
--size;
}
return ((uint32_t)CRCRESR << 16) + ~CRCRESR;
}

My query: 4400 is the correct start address of flash memory?

what should be the size as txt will of 128 bytes 

Seen many forum for the same topic but didnt get clear idea plz guide me for the same

  • Hello Parth,

    The MSP430FR6989 is an FRAM based device, so there is no Flash present on the device. The FRAM Controller for the device already supports bit error correction and uncorrectable bit error detection. It also has an Memory Protection Unit (MPU) that you can use to prevent unwanted writes to the FRAM. Also, due to some of the inherent properties of FRAM structure, it is more reliable than FLASH in a lot of aspects. For more information on this please see the following application notes:
    MSP430 FRAM - How To and Best Practices (http://www.ti.com/lit/slaa628 )
    MSP430 FRAM Quality and Reliability (http://www.ti.com/lit/slaa526 )

    All of the above is to say, you may not need a memory integrity check with FRAM due to its nature and features added to the controller. That being said, if you still want to have this manual check, then you can find the memory start of address of this particular chip within the datasheet. Please see Section 6.13 "Memory", Table 6-45. " Memory Organization."
  • hi thank you the reply,

    as my customer wants to test the firmware integrity .so i just wanted to read the data from FRAM and calculate the CRC but the code mention above  does not work for me plz advice me for the same

  • hi ,

    i tried with the below code to read the data 0x8800 but i am unble to get the data of memory and  attachedthe txt file and as iam expecting the buffer data to be 4F,14,F1 correct me if i am wrong .prjct.txt

    char* data;

    char readResult = 0;

    readResult = boot_readMemory(0x8800,2,data);//

    char boot_readMemory(unsigned long addr, unsigned int length, char* data)
    {
    unsigned long i;

    for (i = addr + length - 1; i >= addr; i--)
    {
    data[i - addr] = __data20_read_char(i);
    }
    return 0;
    }

  • Hi,

    I tried with two three different method as i am to read the hex data one by one with the following code

    char temp_8bit[3] ;
    long address = 0x9000;
    unsigned long i;

    temp_8bit[0] = __data20_read_char(address++);
    printf("data1 = %02x\n",temp_8bit[0]);
    temp_8bit[1] = __data20_read_char(address++);
    printf("data2 = %02x\n",temp_8bit[1]);
    temp_8bit[2] = __data20_read_char(address++);
    printf("data3 = %02x\n",temp_8bit[2]);

    but my query is how do i save the data in buffer as flash is of length 0xBB80 plz reply back soon
  • Hello Parth,

    Again this is FRAM not Flash so it acts a little differently. You can read and write to FRAM just like RAM. This means you only need a pointer to read/write. The _data20_read_char(x) is a legacy macro. You woulnd't use it here. If you like, you can make a dedicated buffer when you start your program, within FRAM for this purpose. To do that just decalre an array with the #pragma PERSISTENT .

  • hi ,

    If you can share some i just want the whole data that is stored in FRAM and want to calculate the CRC for that 

  • Hello Parth,

    I do not have an example of exactly what you are looking for. There is an example of CRC with MSP430Ware for this device. You can access MSP430Ware via the TI Resource explorer. TI Resource Explorer can be found within CCS or at http://dev.ti.com . Navigate to TI Resource Explorer -> Software -> MSP430Ware -> Devices -> MSP430FR5xx_6xx -> MSP430FR6989 -> Peripheral Examples -> Register Level -> msp430fr69xx_crc.c
  • 4666.prjct.txthi Jace,

    This is exactly  i wanted to do but if you refer the code CRC input is given hard coded and in my application i want to take from Txt  file which start from the address @4400 ,8800,ff80,ffc6 and end to q as i want to read the data of whole txt file 

  • Parth,

    you won't be able to do this unless you read in and parse the TI TXT file. The address identifiers (@ox4000) are not downloaded into the part. The linker reads htese and loads the part accordingly. You'll have to hard code boundaries per device.

  • hi Jace,

    I am thinking of this method

    1. First read 1kb of data From Ti-Txt file and save it in a buffer and do a crc as such for whole 128kb of memory 

  • hi ,

    if i want to write the crc data at infoD how do i write that
    below is the code

    #define FRAM_TEST_START 0x4400
    uint16_t *FRAM_write_ptr;

    crc_Result = 0x1234
    FRAM_write_ptr = (uint16_t*)FRAM_TEST_START;

    FRAMCtl_A_write16((uint16_t *)crc_Result ,FRAM_write_ptr,2);
    }

    void FRAMCtl_A_write16(uint16_t *dataPtr, uint16_t *framPtr, uint16_t numberOfWords)
    {
    while(numberOfWords > 0)
    {
    //Write to Fram
    *framPtr++ = *dataPtr++;
    numberOfWords--;
    }
    }
  • Hello

    For an example of how to write to FRAM, please see the FRAM Write example wihtin the code examples within MSP430ware. Take the following path: TI Resource Explorer -> Software -> MSP430Ware -> devices -> MSP430FR5xx_6xx -. MSP430FR6989 -> Peripheral Examples -> Register Level -> msp430fr69xx_framwrite.c
  • hi
    I have tried the example and it is working but if i want some particular fixed location to stored crc cvalue for example i want to store in infoD 0x1800 then how to write that one and does the value i can see in hex/txt file
  • Hello,

    If you want to store information at a particular address, then you just have to define your pointer as that address. You can use the PERSISTENT #pragma I described earlier to ensure the compiler leaves that data alone. Pragmas for CCS are thoroughly described within the CCS for MSP430 User Guide.
  • hi

    i want to write the data with fixed pattern for FRAM2 start address 0x10000 and length 81920v as i am using the ref code from framctl.c
    i observe that i can write the data upto 300bytes only so how do i write into total 81920 bytes

    void FRAMCtl_fillMemory32(uint32_t value,
    uint32_t *framPtr,
    uint16_t count)
    {
    while(count > 0)
    {
    //Write to Fram
    *framPtr++ = value;
    count--;
    }
    }

**Attention** This is a public forum