lilyhack 3 Posted August 9, 2016 Share Posted August 9, 2016 I am building a control system (TM4C129/123) that generates many data. These data are sent back to a higher level controller (Raspberry Pi) through ZigBee. Now, instead of TI always sending the data, I want to change the system so that when Raspberry Pi request data, only then TI sends data. So that means storing those data until the data request come. The data can be lost after the power off. How do I do that? I understand there is a limit to how long we can store the data depending on the size of the data. Quote Link to post Share on other sites
PTB 27 Posted August 10, 2016 Share Posted August 10, 2016 You could also use some kind of external storage. If the data isn't too much you could store in an external eeprom chip. I2c or spi. Alternatively you could use an sd card. Quote Link to post Share on other sites
L.R.A 78 Posted August 10, 2016 Share Posted August 10, 2016 You can use internal EEPROM or the flash.The TM4C1294 should have more than enough flash, and the tm4c123 should be enough depending on your code size and data size. Quote Link to post Share on other sites
lilyhack 3 Posted August 10, 2016 Author Share Posted August 10, 2016 Do you have an example of how to read/write to the internal EEPROM? Quote Link to post Share on other sites
L.R.A 78 Posted August 10, 2016 Share Posted August 10, 2016 Note that the EEPROM is kinda small compared to the flash.The TM4C123 has 2KB and the TM4C1294 has 6KB.You access it in blocks of 16 word.There is probably a example in Tivaware.Here is how I enable it: bool eeprom_good = false; if(!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0)) { SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0))); } if(EEPROMInit() == EEPROM_INIT_OK) { eeprom_good = true; } return(eeprom_good); How I read it: uint32_t temp; EEPROMRead(&temp, address, 4); return temp; And how I write into it: uint32_t temp; uint32_t result; temp = value; result = EEPROMProgram(&temp,address,4); return(result); Fmilburn and lilyhack 2 Quote Link to post Share on other sites
L.R.A 78 Posted August 10, 2016 Share Posted August 10, 2016 Check Tivaware manual on what the functions EEPROMRead and EEPROMProgram take as parameter Quote Link to post Share on other sites
L.R.A 78 Posted August 10, 2016 Share Posted August 10, 2016 btw, using the flash should be easy.The problem is you have to erase an entire block to write it.The TM4C123 has blocks 1KB and the TM4C1294 is of 16KB. So you can for example simply erase an entire block and then write 1 word (or just byte? I don't remember how specific you can write) as data arrives. Since you erased the entire block you can do that.Problem is, if you want to go back and start over the block, or change a value, you have to erase the entire block! Just be aware if you end up using flash 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.