LPC1788 EEPROM

Dear all,

I hope everything is fine with you.
Anybody has an example which demonstrates how to use LPC1788's EEPROM?
I have written the following code in C++ and it does not work, I am wondering what the problem might be:

#include "LPC177x_8x.h"                 // Device header

unsigned int x = 0;

int main()
{
        LPC_EEPROM->CLKDIV = 319;
        LPC_EEPROM->WSTATE = (1<<0)|(6<<8)|(4<<16);
        LPC_EEPROM->INT_SET_ENABLE = 1<<26;            // Enable write operation finished interrupt
        NVIC_EnableIRQ(EEPROM_IRQn);
        LPC_EEPROM->ADDR = 0x40;                     // ********************
        LPC_EEPROM->CMD = 0x05;                              // 32 bit write command
        LPC_EEPROM->WDATA = 0x15;
        while(1);
}

void EEPROM_IRQHandler()
{
        LPC_EEPROM->INT_CLR_STATUS = 1<<26;    // Clear interrupt flag
        x = 10;
}

Best regards

More questions in this forum