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.

MSP430I2041: data storage required

Part Number: MSP430I2041


Dear,

I want to store few Instrument settings inside the controller memory & that can be modify in running application also like we do with eeprom memory.

Currently, I am using INFO A segment (0x1000 to 0x1400 )to store data but data could not rewrite untill erase the whole segment.

can you guide us how to over right data in this memory or do you have any other solution for this.

I am following below flow.

FCTL2 = FWKEY | FSSEL_1 | FN1 | FN3 | FN5; // MCLK/42 for Flash Timing Generator

if(FCTL3 & LOCKSEG) // If Info Seg is stil locked
{
FCTL3 = FWKEY | LOCKSEG; // Clear LOCKSEG bit
}
FCTL1 = FWKEY | WRT;

//addr is between 0x1000 to 0x1400 INFO A memory

void write_eeprom_memory( UINT16 addr , UINT16 value  )
{
fram1_read = ( volatile UINT8 *)addr ;
*fram1_read = value ;
}

UINT8 read_eeprom_memory( UINT16 addr  )
{
UINT8 temp8 ;

fram1_read = ( volatile UINT8 *)addr ;
return *fram1_read ;
}

  • Dear Shrinivas,

    i am already used same example code, problem is whenever I will try to overwrite value of same location it would not be excepted by memory

    for example

    void main(void) {
    WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog Timer

    FCTL2 = FWKEY | FSSEL_1 | FN1 | FN3 | FN5; // MCLK/42 for Flash Timing Generator

    write_InfoSeg(value++); // Write value to Information Segment, increment value

    while(1) {
    __no_operation(); // SET BREAKPOINT HERE
    }
    }

    void write_InfoSeg(char value) {
    unsigned char *Flash_ptr; // Flash pointer
    unsigned int i;

    Flash_ptr = (unsigned char *)SEGSTART; // Initialize Flash pointer

    if(FCTL3 & LOCKSEG) { // If Info Seg is stil locked
    FCTL3 = FWKEY | LOCKSEG; // Clear LOCKSEG bit
    }
    FCTL1 = FWKEY | WRT; // Set WRT bit for write operation

    for (i = 0; i < SEG_LEN; i++) {
    *Flash_ptr++ = value; // Write value to flash
    }

    FCTL1 = FWKEY; // Clear WRT bit
    FCTL3 = FWKEY | LOCKSEG; // Set LOCKSEG bit
    }

    In above if I call write_InfoSeg(value++) first i will be excute but when I call this function again that time the *Flash_ptr not updates and store previous value varialble

  • Hi Rohit,

    In your code, inside main{}, you are calling write_InfoSeg(value++) only once. So I don't think the memory will be updated again after getting set to "value" after the 1st time.

    Srinivas

  • Dear Shrinivas,

    Thank you very much for update.I need 128 bytes  in side the controller to store data and its update frequently in running application. can you tell which location I can used & how.

  • Hi Rohit,

    You should be able to use the Information segment for this purpose. Any 128 bytes in the range 0x13FFh to 0x1000 should work. You can modify the example code's write_InfoSeg() to also include the specific location you want to write.

    Srinivas

**Attention** This is a public forum