EEPROM, flash, RAM, data memory, instruction memory - Page 1
Forum section: electronics / beginners

author: Stove
author_rank: Contributor
timestamp: August 15, 2013, 08:54:42 pm
content: I'm a bit confused about all these types of memory. I know the various types of memory, but why to they mix all of them in modern micro controllers? It must have something to so with the access time and number of write cycles and cost... Can someone explain what the most common configuration is? And why are data and program separated?

author: mariush
author_rank: Super Contributor
timestamp: August 15, 2013, 11:05:10 pm
content: flash memory is for storing the program into the chip... slow to write and slow to read , has a finite number of writes (10s of thousands or more). when powered off data is not lost.eeprom - memory sort of like the flash memory, used by programs to write small pieces of information or read configurations (for example, let's say a multimeter that has some buttons with several functions, it would store in the eeprom the last function selected for each button so that when you power on the multimeter next day, the microcontroller can read the stuff from the eepromdata stored in an eeprom can last for years, much longer than in flash memory, it's more resilient. it's also easier to write to it, writing to flash is more complicated and some microcontrollers don't implement it (the program can't write to flash where the program itself is stored)can handle more writes than a flash usually but it's also a type of memory with finite number of writes. when powered off data is not lostram - fast memory, needs to be constantly refreshed so uses power constantly, when microcontroller is turned off data is lost. much faster than flash or eeprom, lower access times, if i remember correctly more complex and takes more space on the silicon die compared to flash and eeprom and thats why usually microcontrollers have a low amount of ram available.the rest... well, lots of this you can easily learn searching about them on Wikipedia, or going on Digikey or Farnell or some stores and read the datasheets for some eeprom chips , sram chips etc and you can learn a lot from them.

author: Stove
author_rank: Contributor
timestamp: August 16, 2013, 08:34:29 am
content: So since the flash memory is slow, does the program have to be copied to the ram once it starts up?

author: SeanB
author_rank: Super Contributor
timestamp: August 17, 2013, 06:07:41 am
content: Flash and EEPROM are the same technology, both store data as a charge on an insulated gate inside, and can be erased electrically. Only difference is size wise, EEPROM typically is a few hundred bits to around a megabyte, and generally flash starts at about 1 meg and goes up to gigabytes.Typically flash is fast enough to use with most microcontrollers ( they have it internally to store programs, so it is used direct. In a PC normally it is copied into DRAM at startup, as it is a lot faster, but in most cases it is going to run from a very fast L1 cache in the actual processor, as to the GHz processor any memory not on the actual die is very slow, and will take hundreds of processor clock cycles to access any single bit of memory.

author: hlavac
author_rank: Frequent Contributor
timestamp: August 17, 2013, 09:36:48 am
content: Flash is not slow to read. You are fine running microcontroller programs from it.Slowness is in the writes as they consist of erase and write and these are both slow.The only real difference between EEPROM and FLASH is that flash is erased in large chunks (pages) while EEPROM lets you update single byte / whatever the smallest addressable unit is.The erase is relatively slow, so when changing whole page at a time flash is page size times faster.

author: Psi
author_rank: Super Contributor
timestamp: August 17, 2013, 10:14:39 am
content: Quote from: hlavac on August 17, 2013, 09:36:48 amYep, that's probably the most important thing to keep in mind.

author: hlavac
author_rank: Frequent Contributor
timestamp: August 17, 2013, 10:22:46 am
content: RAM in microcontrollers is typically SRAM, it does not need refreshing and consumes negligible power when idle. But there is not much of it as it consumes more die space than DRAM.As for data/program memory confusion, this is something called Harward architecture (as opposed to von Neumann), where you have separate memories for program and data. This has some advantages:- they can have different word size (typically 8-bit data byte, 12-bit or 16-bit instruction word)- they can operate at the same time since they have separate buses (you can access data while fetching the next instruction)- they can be diffrrent type of memory (sram vs flash)