The common terminology for the process when a microcontroller is powered up is called the ‘boot process’.

You might be familiar with the process of booting, as your computer does this everytime you power it on.

For a computer, booting refers to the process of turning a computer on and starting the operating system. In a computer the operating system is the program that enables the software and hardware to work as one.

What happens when a microcontroller is powered up?For a microcontroller, what happens when it is powered up is a similar process. However, microcontrollers do not come installed with an operating system. The operating system is the list of instructions you write (the ‘program’) and load onto the microcontroller. 

So when the microcontroller is powered up, it executes a small program known as the ‘Boot loader’ whose primary job is to load the program  which you have written along with other data, which are then executed by RAM (Random Accessible Memory).

The instructions can be written in either C or Assembly code. 

There are many different types of microcontrollers available which are built on different types of architecture. 

The power up process for each of them might be slightly different, but the overall idea is the same. 

For an in-depth look at what happens when a microcontroller is powered up, keep on reading.

Different types of microcontroller memory

Before we dive into the details of what happens when a microcontroller is powered up, it will help to understand the different types of memory a microcontroller has, and their primary functions.

There are 3 types of memory that a microcontroller uses; SRAM, FLASH and EEPROM.

SRAM

This type of memory is read and written to repeatedly while the microcontroller is running. 

Think of variables that get updated and changed depending on different circumstances. These all get stored in SRAM.

Once powered off, all memory in SRAM is forgotten, making them volatile.

FLASH

Flash memory contains data that does not change or get altered. This is where the program you write and load onto the microcontroller gets stored and will later be executed. This is the same as the operating system of computers.

EEPROM

Unlike SRAM memory, variables stored in EEPROM are non-volatile. When the microcontroller is turned off, the data stored in EEPROM is saved and can be retrieved once the microcontroller is powered up. 

Different types of microcontrollers (AVR, 8051, PIC)

In the world of microcontrollers, you have many options depending on your needs and wants.

While different groups of microcontrollers are built on different architectures and manufactured by different companies, their start-up process when powered up follows the same procedures.

There are 4 commonly used microcontrollers available and used today from hobbyist, to engineers.

They include the PIC, ARM, 8051 and AVR microcontrollers. 

Applications of these microcontrollers include consumer electronics, household appliances, Automotive, Security, Aviation, Medical and many more. 

What is a boot loader?

When a microcontroller is powered off, its program code, and data gets stored in non-volatile memory.

When the microcontroller is powered up, it needs a way to be able to load the program code and other essential data which then can be executed by RAM. 

The way a microcontroller does this is by using something known as a Boot Loader

The boot loader is not only used on start-up, but on Reset too. 

So, if the micrcontroller’s reset button is pressed (which is essentially resetting the system), the boot loader carries out the same task of loading program code and other essential data.

When multiple stages of boot loaders are used, the process is known as chain loading. 

What is a vector table?

We need to briefly cover what a vector table is before discussing the details of start-up of a microcontroller.

A vector table contains addresses of information that are stored in different locations in memory. It essentially is a map that tells the microcontroller where to go.

For example a particular location in memory might contain instructions for what to do during a reset. So, a vector table will have the address pointing to that location.

What happens when a microcontroller powered up ?

The first thing when power is applied, the microcontroller waits for the voltage to stabilize.

After the voltage stabilizes, the microcontroller looks to reset-vector (in the vector table) for the location of where the start-up instruction is in Flash memory.

This is then loaded by microcontroller and executed.

This set of instructions are the bootloader. 

Next, the program code and other data is then loaded onto RAM.

Then the microcontroller runs whatever program you have written.