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/MSP430G2553: managing the main memory correctly

Part Number: MSP430G2553

Tool/software: Code Composer Studio

Hi,

i have a program that combine  keyboard, lcd and more.

i need to save some configurations that will be erase if i flash new software, so i need to set them in the main memory.

but whem i set , for example, a char in address 0x0FE00 the program not working (without reflashing) but if i set the address to 0xFC00 the programm starts to work again.

why this is happen?

thank you

  • When you erase some flash, you erase an entire segment. So you must not erase any data that lies in the same segment as other data that you still need. On the G2553, the interrupt vector table (which also contains the program start address) starts at FFC0.
  • Hi thank you for the reply,
    i have those lines:

    WriteShortToFlash((short*)0xFC00,(short)n_o_d);// Nod_Selection
    WriteLongToFlash((long*)0xFBFE,(long)max_weight);// Max_Weight
    WriteToFlash((char*)0xFBFA,(char)cnt_by);// Count_By
    ReadShortFromFlash((short*)0xFC00,(short*)&n_o_d);// Nod_Selection
    ReadLongFromFlash((long*)0xFBFE,(long*)&max_weight);// Max_Weight
    ReadFromFlash((char*)0xFBFA,(char*)&cnt_by);// Count_By

    as far as i know short size is 2 bytes, long size is 4 bytes, and char is byte.
    putting short on 0xFC00 takes the following addresses: 0xFC00, 0xFBFF
    putting long on 0xFBFE takes the following addresses: 0xFBFE, 0xFBFD, 0xFBFC, 0xFBFB
    putting char on 0xFBFA takes the following addresses: 0xFBFA

    but when i display those values to the screen i'm getting only the char value correct

    Another thing, if i'm changing the addresses (char in the middle):

    WriteShortToFlash((short*)0xFC00,(short)n_o_d);// Nod_Selection
    WriteToFlash((char*)0xFBFE,(char)cnt_by);// Count_By
    WriteLongToFlash((long*)0xFBFD,(long)max_weight);// Max_Weight
    ReadShortFromFlash((short*)0xFC00,(short*)&n_o_d);// Nod_Selection
    ReadFromFlash((char*)0xFBFE,(char*)&cnt_by);// Count_By
    ReadLongFromFlash((long*)0xFBFD,(long*)&max_weight);// Max_Weight

    the short and long value are displayed but not the char value.

    what am i missing?
  • mass erase of main-memory-flash is most common, so I recommend to store the variables in INFO memory, as you can tell the programmer to keep this memory intact.
    Though C don't like hardcoded addresses, not hard to override with casting a hex value as the pointer.

**Attention** This is a public forum