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.

MSP432E401Y: TIRTOS EEPROM Read/Write

Part Number: MSP432E401Y

Hi,

I have TI-RTOS based code and want read and write to EEPROM of the controller. I am using the following code block to read:

void readEEPROM(){
uint8_t i;
Display_printf(display, 0, 0,"%p\n",(void *)&getDatafromEEPROM[0]);
Display_printf(display, 0, 0,"Read EEPROM Data...\n");
MAP_EEPROMRead(&getDatafromEEPROM[0], 0, EEPROM_WORDLIMIT*4);
Display_printf(display, 0, 0," EEPROM Data Read Read...\n");
for(i = 0; i < EEPROM_WORDLIMIT; i++)
{
Display_printf(display, 0, 0,"EEPROM Word %d = 0x%08x\n",i ,getDatafromEEPROM[i]);
}
return;

But the code does not return from MAP_EEPROMRead function and stucks at infinite assembly code. I have the same problem while writing as well. Can someone help me with that?

  • Hi,

      Did you wait for the EEPROM initialization to complete? Please try a simple example as follows. Please also be aware of the known EEprom errata MEM#07 and prevent the mentioned conditions from happening while the EEprom operation is ongoing. 

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

  • Not sure if this is what you need, but the tools support a non-volatile storage in EEPROM. There is a code example in nvsinternal.

    Add a NVS section in the config GUI (I used address 0x10000, size 0x4000).

    Initialise in the usual sort of way.

    NVS_init();
    NVS_Params_init(&nvsParams);
    nvsHandle = NVS_open(CONFIG_NVS_0, &nvsParams);

    Then read and write with something like:

    NVS_read(nvsHandle, 0, (void *) &TheProtectedConfigData, sizeof(protectedConfigData));

    NVS_write(nvsHandle, 0, (void *) &TheProtectedConfigData, sizeof(protectedConfigData), NVS_WRITE_ERASE | NVS_WRITE_POST_VERIFY);

    It seems to take care of most things and worked OK for me!

    Hope this helps.

    Jim