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.

TM4C123GH6PM: please help

Part Number: TM4C123GH6PM

i made a small driver for eeprom as the driver on github dont work with me it gave me 3 error undefined symbol SysctlDelay  ,,, undefined symbol Sysctlperipheralreset ,,,,,,,, undefined symbol main

so i made my own driver but it has a problem when i run the code on keil the EEPROM base register and offset register points to the same memory part all the time which means when i write on the register EEDRW IT changes and store in the memory location but when i rewrite on it after increaminting the offset and block it doeasnt change the memory part and then it rewrites on the old data here is a copy of mt test code note that there are many hard coded part as iam testing note that aslo i open the memory from the simulator in keil in the systejm viewer memory 1                                                 

#include "tm4c123gh6pm.h"
#include <stdint.h>
#define EE 0x00000
volatile uint32_t *hwreg_ptr;

void delay(uint32_t n){
while (n>0){
n-- ;
}
}


void EEPROM_wait_for_write(void) {
while( EEPROM_EEDONE_R !=0X00) ;
}


void EEPROM_wait_for_done(void){
while( EEPROM_EEDONE_R !=0X0) ;
}

uint32_t EEPROM_Init() {
delay(6);
SYSCTL_RCGCEEPROM_R |= 0x01;
EEPROM_wait_for_done();
while( (EEPROM_EESUPP_R & 0x0C) != 0)
{
return(-1);
}
SYSCTL_SREEPROM_R |= 0x01 ;
delay(6);
while( (EEPROM_EESUPP_R & 0x0C) != 0)
{
return(-1);
}
EEPROM_wait_for_done();
while( (EEPROM_EESUPP_R & 0x0C) != 0)
{
return(-1);
}

return 0 ;
}

void EEPROM_Write(char *data,uint32_t address,uint32_t bytes)
{

uint32_t block= 0 ;
uint32_t offset = address % 4 ;
uint32_t i ;
uint32_t k = 0 ;
uint32_t words = bytes /4 ;
uint32_t Byte_Num = 4 ;
EEPROM_EEOFFSET_R =8 ;
EEPROM_EEBLOCK_R = 8 ;
EEPROM_EERDWR_R = EE;
for( i = 0 ; i < words ; i++){
if(offset ==16)
{ block ++ ;
offset = 0 ;
}
for ( k=0 ; k <= 3 ; k++)
{
EEPROM_EERDWR_R |= data[k] ;
delay(10);
EEPROM_wait_for_write();
if(k != (Byte_Num - 1)){
EEPROM_EERDWR_R = EEPROM_EERDWR_R << 8 ;
}
}
EEPROM_wait_for_write();
offset++ ;
EEPROM_EEOFFSET_R = offset ;


// 0x400A0000,0x400FFFFF
}

EEPROM_wait_for_done();
delay(10);
}


int main ()
{

uint32_t x = 0x400AFA12 ;
char myString[] = "ABF";
EEPROM_Init() ;

EEPROM_Write(myString ,x,8);
EEPROM_EERDWR_R = EE;
while(1){}

}

so could you please help me in solving only one of these 2 problems i use tm4c123gh6pm

  • Hi,

      Is there any strong reason why you are not using TivaWare SDK which is a proven suite of libraries and tools for ease of software development? Please download the latest TivaWare from https://www.ti.com/tool/SW-TM4C. I will suggest you run a simple example like hello or blinky to get familiar with the SDK. The error you have is due to missing header files and if you use TivaWare examples they will be taken care of. You will need to add #include for modules that you want to use in your application. For example, SysctlDelay is a function that belongs to the Sysctl module. You will need to include the header file as follows. 

    #include "driverlib/sysctl.h"

      

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

  • okay thank you so much ut worked but i have a small issue in the array i want it to be an array of doubles not ana array of unsigned integers this is a must for my code so could you please help me in that taking in consecration that the function in the driver of the eeprom work with array of unsigned intgers (the function that write and the function that read .