developer_bt 1 Posted August 31, 2014 Share Posted August 31, 2014 I noticed a problem with the EEPROM library TM4C1294 Connected LaunchPad. I tried this example but without success: /* Example 31.1 - Arduino internal EEPROM demonstrationhttp://tronixstuff.com/tutorials > chapter 31 | CC by-sa-nc */ #include <EEPROM.h> int zz; int EEsize = 1024; // size in bytes of your board's EEPROM void setup(){ Serial.begin(9600); randomSeed(analogRead(0)); } void loop(){ Serial.println("Writing random numbers..."); for (int i = 0; i < EEsize; i++){ zz=random(255); EEPROM.write(i, zz); } Serial.println(); for (int a=0; a<EEsize; a++){ zz = EEPROM.read(a); Serial.print("EEPROM position: "); Serial.print(a); Serial.print(" contains "); Serial.println(zz); delay(25); } } After reset only print "Writing random numbers ..." and freezes. The same code works with TM4C123. I use the latest library from GIT. Quote Link to post Share on other sites
Rei Vilo 695 Posted August 31, 2014 Share Posted August 31, 2014 The variable zz seems to be an int while EEPROM.write writes a byte. More generally, I recommend you to use the strong types int{8|16|32|64}_t instead of the weak types like int. int could mean int16_t or int32_t depending on the MCU. Similarly, what type is required for the address? Quote Link to post Share on other sites
bobnova 59 Posted August 31, 2014 Share Posted August 31, 2014 I did some testing on this, there's something odd about the TM4C129 EEPROM. Using the EEPROM.h library it hangs on writing. If I use ROM_EEPROMProgram it writes just fine (I think, doesn't hang anyway), but when I call ROM_EEPROMRead it hangs. These calls work just fine on the Stellaris and TM4C123 launchpads. I think next up is opening the 2 kilopage datasheet and trying to find answers in there. I do not have the brain energy for that right now, though. Quote Link to post Share on other sites
igor 163 Posted September 1, 2014 Share Posted September 1, 2014 Just looked at the Energia EEPROM library - seems like could use some refinement. (Like error checking (e.g. it takes an int argument as an address but doesn't check for negative addresses), checking for error returns, API to get EEPROM size, etc.) Also, none of it seems to check for TM4C123 devices where the EEPROM can brick the device. Have you tried checking the return codes from write when you use driverlib? Checking EEPROMStatusGet() after using the EEPROM library? Have you tried using the non-ROM versions of driverlib? (doesn't look like any fixes in the RAM version, but might be worth confirming). Quote Link to post Share on other sites
developer_bt 1 Posted September 2, 2014 Author Share Posted September 2, 2014 I tried with strong types, uint8_t about the values, and uint16_t and uint32_t for addresses but without success. Quote Link to post Share on other sites
LiviuM 43 Posted October 4, 2015 Share Posted October 4, 2015 Hello, the EEPROM library comming with Energia doesn't work or me neither, but after some changes I've been able to successfully write and read the EEPROM on my TM4C1294. As stated on e2e forum, the EEPROM should be enabled like any peripheral. I've put the initialization code from the e2e page in a new EEPROM methode: void EEPROMClass::init(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); //#include <driverlib/sysctl.h> also necessary EEPROMInit(); } More than that, the ROM functions in driverlib don't work, but the "non ROM" ones do => I've changed the library to use these ones. Attached are the changed EEPROM files (.h & .cpp). I haven't done any improvement (as suggested by Igor) to the library. Hope this helps someone! Regards, Liviu EEPROM.cpp EEPROM.h Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.