1
\$\begingroup\$

I had a small query which I couldnt find a short answer in google. for storing small amount of data ( say 8 bytes ) in an embedded system (containing an external Flash too), is it preferred to store in EXTERNAL FLASH instead of the controller's INFO MEMORY ( MSP430 in my case).

My query is not specific to MSP430, but in general.

I was told by my lead that INFO Memory is not reliable and External Flash should be used. I am not convienced.

I was hoping if there is any technical reasoning as to which memory is more reliable (considering that proper care is taken while writing to memory).

Thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ This sounds like a question for your lead. Perhaps there is a particular context or application where this is the case. \$\endgroup\$ – semaj Dec 28 '15 at 15:57
  • 1
    \$\begingroup\$ The question also depends on how valuable the information is. If it is calibration data that is infrequently written and expensive and time consuming to reproduce, pick the most secure method you have. Which method survives removing an IC from the board and reinstalling it? \$\endgroup\$ – Weather Vane Dec 28 '15 at 19:31
  • \$\begingroup\$ @WeatherVane , The data i am storing is the CRC of the Firmware image. used to upgrade the Firmware (which may or may not happen) So Write cycles are very low and Read cycles are more. Under no situation, any of the IC will not be removed. My query was to know the 'Secure' choice between the 2. \$\endgroup\$ – Feroze Mohamed Dec 30 '15 at 8:05
1
\$\begingroup\$

From a purely technical standpoint, I see no immediate reason why external flash would be better given equivalent erase/write cycle count and storage volume.

If you've checked all the datasheets, you could take this up with your lead as it might save the company money and gain you some "points" for your next annual review or when its time renew a contract, etc. But don't go against what your lead says without first getting him/her on your side.

Also, the technically superior solution, might not be the right solution for your company or your project.

You might be "wasting" money on chips to save money elsewhere, e.g. maybe those flash chips put you just past a minimum dollar threshold to get free support that would otherwise cost more than the unnecessary flash.

Or you might be using external flash because the end customer expects / requires it. I've seen customers say: "though shall not use any of component X" for seemingly nonsense reasons, but the customers pay the bills :).

Or maybe you are absolutely right, but its too late / costly to make a board or bill-of-material change.

Point being: When you're in the business of making an actual physical product, there are a lot of factors behind decisions that might make no sense at all to an entry level developer or even a very experienced developer that's new to embedded work.

\$\endgroup\$
  • \$\begingroup\$ Thank you for the reply. I completely agree with what you mentioned. However I wanted to know the technical reason behind favoring one against the other for my own learning and growth. And also I dont want to impose the same on my juniors some point in the future without myself having full justification. Also in my project, I already have External Flash on board for other usage. As mentioned , I just want to learn. \$\endgroup\$ – Feroze Mohamed Dec 30 '15 at 7:44
0
\$\begingroup\$

I do not know any reason why external FLASH should be more reliable than internal FLASH memory. If it was not technically reliable then, programming the chip would be like playing roulette ;-).

But, compared to RAM memory, FLASH memory can only take a small number of rewrite cycles (~1000 up to ~10.000 times depending on the type). But that's the case with external flash too. So if you want to continously write data, it would be better to use battery backed up RAM (e.g. DS1307 is a RTC with additional 56 Bytes of nonvolatile RAM). An alternative is EEPROM which can be programmed ~1,000,000 to ~100,000,000 times.

If you use your MCU to frequently try out new programs where the extra data you mentioned will not change then, it's likely better to use external FLASH to prevent accidential overwrite the data. Perhaps that was the intention of your lead.

And it's also possible that the data is derived from the programs execution. (?) Then, if you are not carefull, reprogramming the chip could overwrite the previously collected data. That would not be the case for external memory. So it's possible that you destroy valuable data by reprogramming the chip. That could also be the meaning of what your lead said.

\$\endgroup\$
  • \$\begingroup\$ hi, Thank you for replying. So basically Write cycles are high for external memory compared to the INFO memory, which makes sense, however in my case, I will be using the INFO memory very rarely to WRITE and more often to just READ from it. also INFO memory is password protected and there cannot be accidentally overwritten. I have a dedicated function which unlocks, writes and relocks the Info Memory. I am using this to store the CRC of the image file. and this CRC gets updated very rarely (when ever Firmware is updated, which is may 2 times in its entire life cycle). \$\endgroup\$ – Feroze Mohamed Dec 30 '15 at 7:52
0
\$\begingroup\$

Well, this may depend on so many things. But first of all: did you ask him/her "Why?" What was the answer?

Anyway, all things being equal (including write endurance -- BTW, please specify the external flash chip so we can be more specific!), there are issues like:

  • The purpose & life-cycle of the data you need to preserve: does it need to survive an MCU failure/upgrade? (See also Weather Vane's comment to the question.)

  • The thing Peter P. Kiefer also referred to: in addition to generic programming mistakes that pose about the same risk to both internal and external flash, the info memory might also be overwritten accidentally by code specific to tampering with the MSP only.

  • Power: writing to the MSP flash requires certain minimum voltage level.

  • Timing: incorrectly set system clock or incorrect (e.g. too long) write time may screw the flash update.

Etc. Depending on the external chip, these potential pitfalls may not apply there. (But then, there may well be others...)

See (much) more details about MSP430 flash considerations e.g. here:

\$\endgroup\$
  • \$\begingroup\$ Thank you for the response and the links. 1. Data stored is about 4 to 8 bytes at max, and WRITE happens only once or twice in its entire life cycle. however the READ operation happens more frequently. 2. Info Memory is Password Protected and from the code stand point there is very least chance that data overwrite may happen. 3. My concern was, once data is written to memory, is there any chance that the data may be corrupted when compared to the External Flash. once again thank you for the links. I will check the data retention of the INFO memory. \$\endgroup\$ – Feroze Mohamed Dec 30 '15 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.