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.

In MSP430Gxxx, Flash Can be act as EEPROM for storing data? it have the function of BOR?

Other Parts Discussed in Thread: MSP430G2553

Hi:

   I want to use MSP430Gxxx, i want  to have some space  for data storage like  EEPROM in  flash.

   Can you  tell me the MSP430Gxxx have the function of BOR ?  i will use BOR.

 

Fred

  • Fred,

     

    Yes, the MSP430Gxxx that I've looked at all have Brown Out Reset (BOR) integrated:

    http://www.ti.com/ww/en/mcu/valueline/index.shtml?DCMP=Value_Line&HQS=Other+OT+430value

    You can look at the link and see their general features, BOR included.

     

    Your ability to use Flash as data storage is limited by the size of the flash and the size of your program. Please note that the value line has more limited FLASH than other MSP430 devices. Also, Flash behavior is not exactly like EEPROM. It all depends on your application

     

    Gustavo

  • Hi Gustavo L:

         Flash Behavior is not exactly like EEPROM, what do you mean?

        Where I can find relative documents? I need it.

    Fred

  • Flash and EEPROM are distinctively different technologies. For one, Flash is erased in blocks and not byte by byte.

    A great source for a general overview on Flash is Wikipedia:

    http://en.wikipedia.org/wiki/Flash_memory

     

    Also some MSP430 Flash App Notes:

    http://focus.ti.com/lit/an/slaa334a/slaa334a.pdf

    http://focus.ti.com/lit/an/slaa392/slaa392.pdf

     

     

    Gustavo

  • fred wang said:
    Flash Behavior is not exactly like EEPROM, what do you mean?

    On flash, you can only write '0' bits to the originally all-1 flash cells. To change a bit from 0 back to 1, you have to erase the whole segment of flash (for cod eflash usually 512 bytes) and all will be all-1 again.
    The info flash has smaller segments (64, 128 or 256 bytes, depending on device). Still to overwrite a cell that has been programmed, you'll need to copy all cells of a cegment to ram, change the single one, erase the whole segment and write all cells back to flash.

    EEPROM, however, allows you to directly overwrite a single cell. But it is much slower in access, even if you only read, while flash can be read at full processor speed, and consumes more power wehn accessed. And it is way more expensive :)

  • Hi Gustavo

         About  the links given by you, i can not find the relative content how to assign sizes acting as EEPROM in Flash.

    Best Regards!

    Fred

  • Fred,

     

    I don't understand your question. If you are talking about allocating space to be used in Flash, then that's very subjective. The amount of Flash available depends  on the MSP430 you have chosen and how much flash is left after you download your code. Also, some flash in Information segments is available to be used just for these purposes, but is used for calibration constants.

     

    Gustavo

  • Hi  Gustavo:

         Sorry, I want some code about how to allocate space for data storage in flash.

    Fred

  • I just found this wiki, it should answer your questions:

    http://processors.wiki.ti.com/index.php/Emulating_EEPROM_in_MSP430_Flash

     

    Aside from that, there are good Code Examples for every MSP430 that includes manipulating FLASH. I don't know the exact msp430 variant you use so I can't point you, but look for the zip file with the examples.

     

    Gustavo

  • You can define a static const array. The compiler will place it in flash rather than ram. However, since it is const, you cannot write to it (and simply writing to it wouldn't program flash anyway). Also, it wouln't necessarily end up at a segment border.

    If you know which area you want to taccess, you can use a pointer:
    unsigned char * data = (unsigned char *) 0x1800;
    this will create a pointer that points to 0x1800 (usually one of the info flash segments, see your MSPs datasheet). You can then access this memor location as if it were an array,
    e.g. data[1] will read 0x1801 etc.
    Writing to it, however, isn't as easy, because you'll need to program the flash controller first.

    If you really want to reserve a fixed portion of the main flash for data storage, independently of the other code size and placement, you'll have to define a data storage segment in the linker control and create your data structure in this segment. How this is done depends on the compiler/linker combo and is different for MSPGCC, IAR or CCS. It's a task that's outside the C language specification.
    Usually, such kind of data segments have been already defined for the info flash.

  • Hi Jens-Michael Gross: Thanks! Fred
  • If you are using CCSv4, you can use the DATA_SECTION #pragma.  Here is some more information (http://processors.wiki.ti.com/index.php/Pragmas_You_Can_Understand)

    The idea is that you can tell CCS which address you want to store the data you are allocating.

  • Hi Norair:

         The answer is my requirement. thank you very much.

    Fred

  • Hi

    could you give me code for eeprom emulation in the msp430g2553

    thanks

    Rafi Taub

  • Rafi Taub said:
    could you give me code for eeprom emulation in the msp430g2553


    eeprom emulation is a problem.

    eeprom allows altering individual cells in both directions, flash doesn't. To alter a flash cell from 0 to 1, you'll have to erase th ewhole segment it resides in.

    So to 'emulate' an eeprom, the eeprom write function will have to
    - copy the whole flash segment to ram
    - alter the cell
    - erase the segment
    - write back the whole segment.

    Flash segments in main memory are 512 bytes, which is the total size of the G2553 ram. Including all variables and the stack. So eeprom emulation on main flash is simply impossible.
    However, the info segments are only 64 bytes each, so it is doable. Yet I don't know if anyone has bothered doing it, since it is a very slow procedure (especially since the CPU won't be able to execute code from flash, including interrupt code, during a flash erase or flash write),
    So abusing flash for a simulated eeprom  has a huge impact on the system - designing the storage strategy to be directly aware of flash memory is by far the better/faster choice.

**Attention** This is a public forum