Microcontroller Embedded C Programming Lecture 57| Code memory of the microcontroller

 

Code memory of the microcontroller

 

 

In this article, let’s explore the Code memory of the microcontroller.

Figure 1. Code memory ROM
Figure 1. Code memory

 

The purpose of the code or program memory is to store instructions and constant data of your program.

There are different types of code memories which are implemented inside the microcontroller.

The simplest and cost efficient program memory is ROM(Read only memory). There are different types of read only memories like MPROM which stands for Mask programmable read only memory, EPROM that stands for erasable programmable ROM.

MPROM is truly read-only memory. That means once you program MPROM, you cannot erase it. Once you program it, then it is final. 

EPROM is erasable. But the erasing procedure is very cumbersome. You actually have to take the chip outside of your circuit, and you have to put that under the ultraviolet machine, and then you have to pass the ultraviolet rays, and then you can erase the memory, and then you can program it once again. That’s very tedious and a very cumbersome method. Usage of EPROM is almost obsolete, so you no longer see those kinds of memories inside the microcontroller. 

EEPROM is one more type of read-only memory, which stands for Electrically Erasable Programmable ROM. And we just saw that it is quite famous and is being used in some of the modern microcontrollers as well. Even though it is called as ROM, it doesn’t mean that you are not able to erase it; you can erase it. So, the erasing technique is also very simple, so it is erased by using an electric voltage. That’s why it is called an electrically erasable programmable ROM.

 

There is another type of code memory called OTP, which stands for One time programmable.

These days Flash memories are very much popular in the microcontroller domain. Flash is also Electrically Erasable Programmable ROM, but the fabrication technology which is used for flash and EEPROM is completely different. Even though the purpose is the same: both are non-volatile, and erasable, writable memories, there is a difference between cost and speed. So, flash memory is being dominated as code memory in today’s microcontrollers. 

There is one more non-volatile memory, that is FRAM. FRAM stands for a Ferroelectric Random Access memory. Most of the STM32 microcontrollers don’t have this memory as code memory. The reason is that if you use this as a code memory, then the cost of the microcontroller will shoot up. This is costlier than flash. But the important thing about Ferroelectric Random Access memory is its speed. The access speed is very much high compared to the flash memory.

 

So, you find FRAMs as code memory in some Texas Instruments MSP microcontrollers. For example, here is a block diagram of the MSP430FR422 microcontroller(as shown in Figure 2). Here, in this microcontroller, you don’t see a Flash as code memory. So, they have used FRAM here, and it is of around 8 kilobytes. So, take a look into its size. It’s just 8 kilobytes. I mean, this microcontroller may be targeted for some low power, ultra low power applications. 

Figure 2. MSP430FR2422 Microcontroller
Figure 2. MSP430FR2422 Microcontroller

 

These are some of the different types of code memories which are implemented inside the microcontroller. 

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.