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.

EEPROM offset incrementing

Other Parts Discussed in Thread: EK-TM4C123GXL

I am having a few problems reading and writing to the internal EEPROM of my Tiva C Launchpad (EK-TM4C123GXL)

I have tried both driverlib and CMSIS but with no success.

From the debugger it seems the eeprom offset register increments by 2 with every clock cycle.

I did a search and could only find a small mention of it in this post http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/206262.aspx


As soon as I enable the EEPROM clock the offset start incrementing.

I want the EEPROM read and writes to be blocking these are the steps I take:

  • Set the Main clock to 80Mhz ( this is confirmed working with the UART )
  • Enable EEPROM Clock
  • Delay 2us
  • Wait for EEPROM Peripheral Ready
  • Wait for EEDONE to become clear
  • Delay 500us
  • Set EEPROM Block
  • Set EEPROM offest
  • Read or Write to the read-write register

There must be something that I am missing

  • Hello Rob,

    The procedure you have mentioned is correct. Secondly, the offset register cannot increment by itself.. If you can attach the program for EEPROM Write and Read, we may be able to help better.

    Please provide the driverlib version

    Regards

    Amit

  • Hello Amit

    My main project is in CMSIS but this is the code I am trying to test driver lib with, I get the same result both way. I have tried 3 different boards so I assume that I am missing something in the code.

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_ints.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/eeprom.h"
     
     
    #define EEPROM_TEST_ADRES 0x0004
     
    struct EEPROM
    {
        uint8_t value1;
        uint8_t value2;
        uint16_t value3;
        uint8_t value4[12];
    };
     
    struct EEPROM eeprom_write_value = {5,7,9826, "Hello World"}; /* Write struct */
    struct EEPROM eeprom_read_value =  {0,0,0,""}; /* Read struct */
     
    int main(void)
    {
        uint32_t e2size,e2block,value;
     
        SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); // 80 Mhz
    
     
        /* EEPROM SETTINGS */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // enable EEPROM
        EEPROMInit(); // EEPROM start
        /*******************************/
    
        EEPROMProgram((uint32_t *)&eeprom_write_value, EEPROM_TEST_ADRES, sizeof(eeprom_write_value)); //Write struct to EEPROM start from 0x0000
     
        EEPROMRead((uint32_t *)&eeprom_read_value, EEPROM_TEST_ADRES, sizeof(eeprom_read_value)); //Read from struct at EEPROM start from 0x0000
    
    		value = eeprom_read_value.value3;
     
    while(1)
     {
     }
     
    }

  • Hello Rob,

    It took me sometime to understand the issue. But here is the synopsis

    In the debugger memory window, you have opened the registers EERDWR and EERDWRINC. When the register is read in the debugger window it causes the address to increment by the EEPROM Controller. If do not keep neither of the EERDWR nor EERDWRINC the auto increment of the address does not happen.

    Regards

    Amit

  • Thanks Amit

    You are correct the debugger was incrementing the address.

    It makes it hard to debug the EEPROM, nut at least I know what is going on now.

  • Hello Rob

    Glad it helped you

    Regards

    Amit

  • Amit Ashara said:
    When the register is read in the debugger window it causes...

    Quite excellent diagnosis Amit - will help all those (landing) here.

    Might there be "other" (mainly peripheral) registers which exhibit similar sensitivity?  (sensitive to either the debugger and/or a simple, MCU "read" of that specific register)

    Seems that your excellent "get" here could be expanded - and placed as a proper, "Warning/Signpost" to guide your client-users around - rather than into - this "unwanted/unexpected" pitfall...

  • Hello CB1 et al,

    Coincidentally, within the last week I was reading the data sheet of a competitor's M4 and noticed they have a unique (I believe) way of handling this.  For registers that are modified by reading them, they offer a doppelganger register that looks exactly the same, but does NOT modify on a read.  They refer to this as "debug view"!  Pretty cool idea that I have not run into before in 30+ years in the business.  This could be interpreted as a suggestion...

    Regards,

    Dave

  • Hello SourceTwo,

    As far as I know C2000 devices implement a debugger lock as well, where debugger read of the registers does not modify the content, especially like FIFO read registers and auto incrementing registers

    Regards

    Amit

  • SourceTwo said:
    Coincidentally, within the last week I was reading the data sheet of a competitor's M4

    Thou treadest dangerously close to, "Blasphemy" mon ami.  (quelle competition?)

    Suspect our identifications - suggested improvements - once again receive (always hallowed) "due notice" - and are then (calmly/quickly) cast to the winds...  (wherefore art thou - "lost, forum template" posts/suggestion?)

    Again - key point (bit muddied & escaped): 

    "Seems that your excellent "get" here could be expanded - and placed as a proper, "Warning/Signpost" to guide your Tiva client-users (i.e. victims) around - rather than into - this "unwanted/unexpected" (sensitive register/debug) pitfall..." 

    (ain't too many C2000 users haunting/slumming - here...)