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.

Stellaris launchpad - EEPROM password protect

Hi I was trying to put password lock for EEPROM , In order to check I wrote the following lines

unsigned long pulPassword[3];

    pulPassword[0] = 0x01;
    pulPassword[1] = 0x02;
    pulPassword[2] = 0x03;

{

    SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
    EEPROMInit();

    EEPROMBlockPasswordSet(0,pulPassword, 3);                        // Set password
    EEPROMBlockProtectSet(0,    EEPROM_PROT_RW_LRO_URW);           /// Block Protect Set
    EEPROMBlockLock(0);                             // lock Block 0

    EEPROMMassErase();
    EEPROMRead(pulRead, 0x400AF000, sizeof(pulRead));
    EEPROMProgram(pulData, 0x400AF000, sizeof(pulData));
    EEPROMRead(pulRead, 0x400AF000, sizeof(pulRead));

While stepping into the the code I was trying to monitor the 0x400AF034 to 0x400AF03C registers but i could notice only 0x00000001 written to all the registers..

Am i making the right calls....

Regards

Rakesh M.

  • Hi dear Muralidharan,

    What u r attempt to write in EEPROM? I need to know the contents of the pulData and also the size of it.

    The vector read or write to eeprom need to be 4-Bytes aligned otherwise a memory corruption will occur.

    Best regards

    Tales Amorim

  • Hello Rakesh,

    A read of 0x1 in the password register means that the password has been applied.

    The other part that I did notice is The usage of the EEPROMRead and EEPROMProgram API's is not correct.

    The correct parameters call for EEPROMRead is

    EEPROMRead(uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count)

    where *pui32Data is the address of the array of data you want to read to

    ui32Address is the address of the EEPROM Locations as 0x0, 0x4, 0x8...

    ui32Count is the number of words that need to be read

    Similarly is EEPROMProgram

    Regards

    Amit