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.

TM4C129ENCPDT: Is there any example code for using EEPROM on a Tiva micro?

Part Number: TM4C129ENCPDT
Other Parts Discussed in Thread: UNIFLASH

I'm using the TM4C129 launchpad board and I want to know if there is any example code for how to use the eeprom for calibration data, etc.

  • Hi Andy,

      There is a small example in the peripheral driver library user's guide. Below is the snippet of code. 

    uint32_t ui32EEPROMInit;
    uint32_t pui32Data[2];
    uint32_t pui32Read[2];
    //
    // Enable the EEPROM module.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
    //
    // Wait for the EEPROM module to be ready.
    //
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0))
    {
    }
    //
    // Wait for the EEPROM Initialization to complete
    //
    ui32EEPROMInit = EEPROMInit();
    //
    // Check if the EEPROM Initialization returned an error
    // and inform the application
    //
    if(ui32EEPROMInit != EEPROM_INIT_OK)
    {
    while(1)
    {
    }
    }
    //
    // Program some data into the EEPROM at address 0x400.
    //
    pui32Data[0] = 0x12345678;
    pui32Data[1] = 0x56789abc;
    EEPROMProgram(pui32Data, 0x400, sizeof(pui32Data));
    //
    // Read it back.
    //
    EEPROMRead(pui32Read, 0x400, sizeof(pui32Read));

  • Hi Charles,

    thanks for that. Is there a way of putting the initial values into the eeprom using Uniflash (or equivalent)

    Regards

    Andy

  • Hi Andy,

      No, there is no such tool available even though it is possible in theory. One can develop a tool that will download the program (e.g. a program similar to the one I show in the last reply) via JTAG interface or even via other serial interfaces using the bootloader. The program will then program the initial values to the EEprom. With that said, the Uniflash or the LM flash programmer does have some capability to program 2 user words to the non-volatile memory. However, the 2 user words are programmable for one-time only. You cannot change them unless you do a "unlock device" which will perform a mass-erase of the entire device including the main flash memory and the EEprom.