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.

Programming internal EEPROM with Interrupts



Hi!

I am using the lm4f eval board and want to program an array into the eeprom.

For this I use the EEPROMProgramNonBlockin Function with the first value followed by the EEPROMIntEnable and Master Interrupt enable.

The EEPROM is activated by clock handler first and I also call the EEPROMInit() function.

I put my EEPROMIntHandler in the startup_ccs.c at the position of FLASH Control. In the Interrupt Handler I want to clear the interrupt and start the write of the nex value.

Now my problem is, that the interrupt never gets called. The first value is written, but the handler is never reached. The rest of the program runs ok.

 

I can see that the EEPROM Write with Increment Value in the EEPROM Register is periodically loaded with the first value and the Current Address Offset is incrementing from 0 by 2 to E and restarting. The EEINT stays at 1, but the Interrupt is never entered (breakpoint at entry).

Am I missing something?

  • Jan,

    Can you post your initialization code and interrupt handler? If the EEPROMIntEnable function wasn't passed the parameter of EEPROM_INT_PROGRAM, it might cause the problem you're seeing.

  • Hi John,

    thanks for your reply. The EEPROM_INT_PROGRAM was passed to the function.

    the relevant code in my program is as follows:

    Init_Clock(void)

    { SysCtlClockSet(
       SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ
         | SYSCTL_OSC_MAIN);

     SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); //enable EEPROM

    ...}

    main()

    {

    Init_Clock();

    EEPROMInit();    //from eeprom.c

    IntMasterEnable(); //enable Interrupts

    ...

    while(1)

    {

    EEPROM_Write_DataBuffer(Data, Address);

     

    ...

    }

    }//end of main

    uint8 EEPROM_Write_DataBuffer(uint32_t ui32_Data, uint32_t ui32_EEPR_Address)
    {
     uint8 ub_Error = 0;

     ub_Error = EEPROMStatusGet();

     if (ub_Error == 0)  {
       EEPROMProgramNonBlocking(ui32_Data, ui32_EEPR_Address);
       EEPROMIntEnable(EEPROM_INT_PROGRAM);
      return (0);
     }
     else
     {
      return (ub_Error); //EEPROM still busy or other error. Please try again later.
     }
    }

    in Startup_ccs.c

      EEPROMIntHandler,// FLASH Control

    in Interrupts.c

    void EEPROMIntHandler(void)
    {
     EEPROMIntClear(EEPROM_INT_PROGRAM);            //This point is never reached (breakpoint in debug mode)

    if (data_ready==TRUE){        //program more

       EEPROMProgramNonBlocking(ui32_MoreData, ui32_EEPR_OtherAddress);
       EEPROMIntEnable(EEPROM_INT_PROGRAM);}

    else{

    EEPROMIntDisable(EEPROM_INT_PROGRAM);

    }

  • I found the problem with the help of an FAE from TI.

    In addition to the EEPROMIntEnable(EEPROM_INT_PROGRAM) the INT_FLASH had to be enabled via IntEnable(INT_FLASH). I thought this was done already with the EEPROMIntEnable Routine, but turns out it has to be done extra.

    Now the Interrupt is executed correctly and the phenomenon with the incrementing offset has stopped also.

     

  • Jan,

    Thanks for replying with the answer. It looks like we both shared the assumption about the EEPROMIntEnable enabling the flash interrupt. Feel free to mark your most recent post as "Verified Answer" to assist future forum users.