Noob question here. I have only a little experience with microcontrollers and all that experience was limited to the 8051. I am working on a project and would like to use the ARM cortex M4 microcontroller. Programming the microcontroller and setting up the registers and IO is easy enough. The project calls for a person to be able to input certain variables like time, weight, etc. Those values need to be stored in some non-volatile memory so that if the embedded system loses power the values will be retained.

Do any of the Cortex M4 microcontrollers have on-chip flash memory (or another form of non-volitile memory) that can be used for data? If yes, then how does the program specify this on-chip memory as the location to store the data?

If there is no on-chip memory as described above I assume a flash memory IC can be connected to the GPIO pins of the microcontroller to store the data externally. Are there any resources that would walk me through this process?

I do not need to store much data so using on-chip resources would be preferable compared with purchasing another IC just to store a few bytes of information.


You will have to read the datasheet for the particular chip you have in mind. There are some M4 chips with high-endurance (100,000 or higher) byte-erasable EEPROM (eg. R7FS7G27H3A01CFC) , others may have writeable flash but must be erased a sector at a time and endurance may be much less.

'ARM Cortex M4' only describes the base characteristics of the core. There are optional features, and the memory and peripheral complement will depend on the individual manufacturer's implementation.

You can easily and cheaply (starting at about 10 cents in quantity) use an I2C or SPI serial EEPROM if you want to store a few bytes of user data, so there is no need to make the inclusion of EEPROM a requirement for the MCU. For example, look at the 128 byte 24C01.

Some may also support a battery back-up, which is usually a bad choice for simple nonvolatile memory storage, but if you need a real-time clock and can stand the data disappearing sometimes when the battery runs down, it might be a viable option.

  • \$\begingroup\$ @boymeetcode - This previous EE.SE question on the same topic provides useful examples, although some links are specific to that family of MCUs, for the reason explained by Spehro: electronics.stackexchange.com/questions/98381/… : A good search term is "EEPROM emulation" if you want to learn about some of the cost vs. complexity trade-offs of trying to use on-chip Flash to store program-generated data, for those MCUs which don't have on-chip EEPROM. \$\endgroup\$ – SamGibson Mar 20 '16 at 13:09

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.