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.

Compiler/TM4C123GH6PM: How to read/write config file on launchpad

Part Number: TM4C123GH6PM

Tool/software: TI C/C++ Compiler

There are 2K storage on launchpad(TM4C123GH6PM). I want to use that to store my config file and each time I power  on my system, I could read from it and start up. Also I need to write if the config file is changed during the running time. Can anyone give me an example on how to read and write a string to the storage on launchpad please? (I don't want to add usb or anything.)

  • Hi Binghui,

     Please refer to section 9.3 in the TivaWare Driver Library user's guide for the example. Below is the code snippet for read/write to the EEprom.

    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));