2
\$\begingroup\$

I understand binary code is stored in the ROM area of an MCU. Typically most MCUs have FLASH EEPROMS. Is this really the NAND type FLASH storage we find in most SSDs?

If not, what are the differences?

\$\endgroup\$

2 Answers 2

5
\$\begingroup\$

No. NAND flash is unsuitable for storing code which is directly executed by a CPU. Nand flash can only be used to store code which is first copied to RAM and then executed from the RAM. There are two reasons for this: firstly NAND flash is not accessible word by word; it's accessed in blocks. Secondly, data in NAND flashes is actually quite volatile and just reading a block of data a few million times results in bit errors creeping into the data. This is not a problem for disk type access where the data is read and written not so often and can be repaired by error correction algorithms in between. But executing directly from the nand flash, a few million read cycles might take just a second or so.

If codes is directly executed from a flash chip then that chip must be a NOR flash chip. Most microcontrollers also include real ROM inside the chip, for storing bootloaders etc. This ROM is often a mask ROM which is really ROM, "Read Only Memory" meaning it cannot be written to at all by the user, it's content is fixed in the chip design using one via mask. Another alternative, instead or additionally, is PROM, Programmamble ROM which consists of transistors with weak emitters which can be burned one by one. This kind of memory bit can be written once, but not erased.

Some background info:

For executing code, all processors require storage which can be accessed on a byte by byte basis. Nowadays, most commonly this memory is the L1 cache RAM which is placed "nearest" to the processor on the (instruction) data bus. Further away from the CPU there can be other types of memory connected to many kinds of buses.

\$\endgroup\$
2
\$\begingroup\$

If you are asking about specific MCU, it would help to know which one. Some of them are combining different types of non-volatile storage. EEPROM and Flash are different types of memory. For example the (currently) popular TI's Tiva C series microcontrollers combine EEPROM and FLASH memories, while FLASH is mainly used for the executable binary storage(but not limited to it) and the EEPROM is used for the application-specific data storage. That specific chips have NOR flash rather than NAND, which is beneficial for MCUs, especially RAM-constrained, since the NOR memories usually allow direct CPU instructions fetching and execution, which is not the case for the NAND. When a program is stored in NAND it is not executable, and has to be copied to RAM in order to run it. But some MCU are using it anyway, mostly those designed to work with some externally extended RAM.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ The EEPROM on the Tiva C series is actually a NOR flash bank with extra control logic wrapped around it. \$\endgroup\$
    – Adam Haun
    May 4, 2015 at 18:24
  • 1
    \$\begingroup\$ @AdamHaun Can you point where this info can be found, please? \$\endgroup\$
    – Eugene Sh.
    May 4, 2015 at 18:25
  • 2
    \$\begingroup\$ Look under the Theory of Operation heading in section 8.2.4.1 of the datasheet (page 551). Note the mention of sector erase, which is the defining feature of flash. This is a description of hardware EEPROM emulation. Also, I worked on the 65 nm process node that the Tiva C chips are made in, and I can tell you there's no real byte-erasable EEPROM there. :-) \$\endgroup\$
    – Adam Haun
    May 4, 2015 at 19:00
  • 1
    \$\begingroup\$ @AdamHaun Ok, that's an interesting piece of information, not sure how useful through :) Thanks. \$\endgroup\$
    – Eugene Sh.
    May 4, 2015 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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