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.
Tool/software: TI C/C++ Compiler
HI,
I have some issues using in saving the IP Address of my device in EEPROM. I am using the example code of lwIP make some changes according to my need. The problem is I want to save the IP Address in EEPROM which I am getting from DHCP and I assign the return value of function to my EEPROM variable, it saving the return address of else statement from "lwIPLocalIPAddrGet()" which is 0xFFFFFFFF. I tried but did not succeded. Please help me if some has knowledge about this.
Best Regards,
Faizan Ahsan
Hi Faizan,
How do you know that it is taking the else statement? If your EEprom programming is not successful then the EEprom will retain the original erased value which is also 0xFFFFFFFF. Below is an example shown in the TivaWare Driverlib userguide. Is this something similar what you used to program the EEprom?
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));
Hello Fizan.
You can use the following code assuming that you have converted the parts of the ip address into 4 distinct bytes and put to the my_IP[4] array
#define IP_Location 32 // the 32nd addressed location of your EEPROM (the 9th word) -or whatever else fits
void changeIP(byte my_IP[4])
{
for(int i=0 ; i < 4 ; i++)
{
EEPROM.write (IP_Location + i , my_IP[i]);
delay(50);
}
}
Here is the link to download the slightly modified EEPROM version of TIVAWARE eeprom, on top of it. Read the documentation. Very handy!
https://www.dropbox.com/s/fvz9r58rjzux5gq/EEPROM_code.rar?dl=0
Hi Bruno,
I have valid IP address and my EEPROM code have no problem, I debugging my code again with the Breakpoints and I realize that I have to use interrupt handler as the function from which I getting IP Address is executed after my EEPROMProgram execute.I will put interrupt then I will check whether the same problem exist or not. Thanks for the help :)
Regards,
Faizan