Posts

Showing posts from February, 2023

What are the different types of Interrupt Controller in an MCU?

Image
  An interrupt is a signal that is sent to the processor to temporarily halt the execution of the current task and handle a higher-priority task. Interrupts are an important aspect of real-time embedded systems , where it is essential to respond to events quickly and efficiently. An interrupt controller is a hardware component that manages interrupts in an embedded system. There are many types of interrupt controllers depending upon the different configurations in the interrupt controller hardware. Below are the most common types of interrupt controllers: Generic Interrupt Controller (GIC): It is designed to be compatible with multiple processors or architectures. It provides a standard interface for handling interrupts, which allows it to be used with different types of processors without needing to modify the software. This makes it a flexible and cost-effective solution for embedded systems that use different processors or architectures. Nested Vector Interrupt Controller (NVIC)

How Interrupt Works ?

Image
  In an Embedded System , a Microcontroller or Microprocessor uses the Input/Output pins to interact with the outer world and the other devices. Output pins take the data or information out and input pins to read the data or information. Software on the microprocessor runs at a very high speed than the hardware interactions. A few milliseconds of delay with the hardware could be thousands of instructions for the software. So for optimal hardware and software interaction, there is a mechanism called interrupts. An interrupt is a signal that temporarily halts the normal execution of a program and directs the MCU to execute a specific piece of code, called an interrupt handler or interrupt service routine (ISR) . Interrupts are typically triggered by external events, such as a button press, a sensor reading, or a timer expiration. Interrupt Sources can be classified into two main categories : Internal interrupt: sources are generated by the MCU itself, such as a timer overflow or a h

What is DMA?

Image
DMA is a technique that allows data to be transferred between devices without the intervention of the CPU. In a typical computer system, data is transferred from one device to another via the CPU . The CPU initiates the transfer, reads data from one device, and writes it to another device. This process can be time-consuming and takes up valuable CPU time, which can slow down the system. It eliminates the need for the CPU to be involved in data transfer by allowing data to be transferred directly between devices. These controllers can be built into the devices or added as a separate component to the system. The DMA controller operates independently of the CPU and uses its own memory address and data buses to transfer data between devices. The DMA controller is programmed by the CPU to read data from one device and write it to another. The DMA controller can transfer data in blocks, making the process faster and more efficient. When the CPU needs to transfer data, it initiates the tran

What is a start-up code in an MCU?

Image
Start Up code of an MCU Starting up an MCU (Microcontroller Unit) involves executing a sequence of instructions that initializes the various on-chip peripherals and sets up the processor’s operating environment. This sequence of instructions is often referred to as the “startup code"  and is typically provided as part of the development tools provided by the chip manufacturer. The startup code is responsible for configuring several hardware and software aspects of the MCU to prepare it for the application code to run. Details of these tasks is as below: Stack Pointer Initialization : Stack Pointer points to the memory location in RAM which will be used by the program to store the function call stacks and the local variables for each function call. Data Section Initialization : Data Section in the memory layout contains the initialized global and static variables. Block Started by symbol (BSS) Initialization : BSS Section in the memory layout contains uninitialized global and sta

Boot Sequence of ARM based MCU

Image
  A boot sequence is a crucial part of any Microcontroller’s (MCU) operation. It is the process by which an MCU initializes and prepares itself for the main program’s execution. The boot sequence is essential because it sets up the system’s environment, initializes the necessary hardware and software components, and loads the main program into the MCU’s memory. In this article, we will explore the boot sequence of an MCU and understand the steps involved in its operation. Power-On Reset (POR): When an MCU receives power for the first time, a hardware-based reset called a Power-On Reset (POR) occurs. This resets all registers and memory to their default state. Check the Reset Vector: After the POR, the MCU checks the reset vector, which is a location in memory that contains the address of the first instruction to be executed. Initialize the Stack Pointer: The next step is to initialize the stack pointer, which is a register that keeps track of the program’s execution. The stack pointe