FabAcademy

Vigyan Ashram

Embedded Programming

This assignment focuses on documenting my knowledge gained in Embedded Programming. It covers fundamental topics such as architectures, memory, peripherals, word size, various microcontroller families, and packaging, as well as my experiences working on a group project. comparing performance and development workflows for different architectures, along with an individual assignment and group assignment.

Group Assignment


Understanding the data sheets of microcontrollers

Studying the datasheet for the XIAO RP2040 Development Board for understanding its functionalities and specifications thoroughly. This document contains detailed technical information, such as electrical characteristics, pinout diagrams, communication protocols, and recommended operating conditions. With this knowledge, we can design, program, and troubleshoot projects effectively. The datasheet guides us to make informed decisions regarding hardware connections, firmware development, and optimization strategies.


Compare the performance and development workflows for other architectures(acco)

In this section, we evaluate various microcontrollers, including our chosen RP2040, by examining key factors such as microcontroller type, core specifications, architecture, operating voltage, and digital pin count. This analysis provides insight into how the RP2040 compares to other microcontroller options and highlights its unique features. Further information can be found in the Group Assignment. Please find group assignment link Click Here

Individual Assignment

write a program for a microcontroller development board.

Embedded System Programming

An embedded system is a specialized computer system made up of a processor, memory, and input/output peripherals, designed to perform a specific function within a broader mechanical or electronic setup. It is integrated into a complete device that typically consists of electrical or electronic components along with mechanical elements. Because an embedded system typically controls physical operations of the machine that it is embedded within, it often has real-time computing constraints. Embedded systems control many devices in common use. For more information click on link Resource Link

Embedded Systems


Embedded Systems Classification

Embedded Systems Classification


Type Characteristics
Mobile Embedded Systems Small and portable systems, like digital cameras.
Networked Embedded Systems Connected to a network, interact with other systems, such as home security systems or point of sale (POS) systems.
Standalone Embedded Systems Operate independently and perform specialized tasks, like calculators or MP3 players.
Real-time Embedded Systems Provide outputs within defined time intervals, crucial for time-sensitive tasks like traffic control systems.

Embedded Systems Performance Requirements


Performance Level Microcontroller Type
Small-scale Embedded Systems Simple microcontrollers, typically 8-bit.
Medium-scale Embedded Systems Larger microcontrollers (16-32 bit) allowing multiple connections.
Sophisticated-scale Embedded Systems Complex algorithms, software, and hardware, often requiring configurable processors and programmable logic arrays.

Common Software Architectures for Embedded Systems


Architecture Type Description
Simple Control Loops Manage hardware and programming with subroutine calls.
Interrupt Controlled Systems Main and secondary loops where interruptions trigger tasks.
Cooperative Multitasking Simple control loop within an API.
Preemptive Multitasking/Multithreading Used with real-time operating systems (RTOS), featuring synchronization and task-switching strategies.

Embedded Systems Applications


Application Description
Telecommunications Telephone switches, cell phones, routers, network bridges
Consumer Electronics MP3 players, television sets, mobile phones, video game consoles, digital cameras, GPS receivers, printers
Household Appliances Microwave ovens, washing machines, dishwashers, HVAC systems, home automation devices
Transportation Aircraft avionics, spacecraft systems, electric motors, automotive safety systems
Medical Equipment Monitoring equipment, medical imaging devices (PET, SPECT, CT, MRI)
Aerospace and Defense Safety-critical systems, fire safety systems, security systems
Wireless Sensor Networking Motes, networked wireless sensors

Basic Structure of an Embedded System


img from google


Sensor System Components


Component Description
Sensor It measures the physical quantity and converts it to an electrical signal which can be read by an observer or by any electronic instrument like an A2D converter. A sensor stores the measured quantity to the memory.
A-D Converter An analog-to-digital converter converts the analog signal sent by the sensor into a digital signal.
Processor & ASICs Processors process the data to measure the output and store it to the memory.
D-A Converter A digital-to-analog converter converts the digital data fed by the processor to analog data.
Actuator An actuator compares the output given by the D-A Converter to the actual (expected) output stored in it and stores the approved output.

For more info refer this site Resource Link

Architecture


Von Neumann Architecture:

The Von Neumann architecture, named after the Hungarian-American mathematician and computer scientist John von Neumann, represents a fundamental design concept for modern computers. In this architecture, both instructions and data are stored in the same memory space, and a single bus is used to transfer both instructions and data between the CPU and memory.
In a Von Neumann architecture, the CPU performs operations sequentially, meaning it can only execute one instruction at a time. This limitation arises because the CPU shares a common bus for fetching instructions from memory and accessing data. As a result, if the CPU is fetching an instruction from memory, it cannot simultaneously perform a data operation, such as reading or writing data.


Harvard Architecture:

In a typical computer using Von Neumann architecture, instructions and data are stored together in the same memory. This means that the same pathways, called buses, are used to fetch both instructions and data. Because of this setup, the CPU can't perform both tasks simultaneously—reading instructions and accessing or modifying data—at the same time.
To address this limitation, Harvard Architecture was developed. In Harvard Architecture, there are separate storage areas and pathways (buses) for instructions and data. This means that the CPU can access instructions and read or write data at the same time without any conflict or slowdown. This separation of pathways helps overcome the bottleneck that exists in von Neumann's Architecture, where the CPU has to wait for one operation to finish before it can start another.
So, the main advantage of Harvard Architecture is that it allows the CPU to perform multiple tasks concurrently, leading to potentially faster and more efficient operation.For more information Resource Link


Difference Between Von Neumann and Harvard Architecture


RISC AND CISC



Microprocessor

A Microprocessor is an important part of a computer architecture without which we will not be able to perform anything on our computer. A microprocessor is like the brain of a computer. It's a tiny chip that follows instructions to do math and logic tasks, producing outcomes. It fetches instructions, figures out what they mean, does what they say, and gives results.


Since I don't have an electronics background, I am eager to learn more about microprocessors so I found valuable information in the resource link I have attached.Resource Link1
Resource Link2

Basics of Microprocessor

A Microprocessor takes a bunch of instructions in machine language and executes them, telling the processor what it has to do. A microprocessor carries out three fundamental functions when processing instructions. It conducts essential operations such as addition, subtraction, multiplication, division, and various logical functions through its Arithmetic and Logical Unit (ALU). Additionally, data within the microprocessor can transfer between different locations. The microprocessor utilizes a Program Counter (PC) register, which keeps track of the address of the next instruction, allowing it to move from one location to another based on the value stored in the PC and takes decisions.
I took assistance to study the microprocessor from the provided website.Resource Link
A regular microprocessor structure looks like this.


Types of Microprocessor

A microprocessor is a type of computer processor commonly used in contemporary personal computers, smartphones, and various electronic devices. It is a central processing unit (CPU) that performs most of the processing tasks in a computer system. The microprocessor is a key component of a computer, as it controls the fetching, decoding, and execution of instructions that are stored in memory.

Processor Types

Types of Processors


Processor Type Description
Vector Processor A type of CPU designed to perform mathematical operations on arrays of data more efficiently than scalar processors.
Array Processor or SIMD Processor Designed for vector computations; employs multiple processing elements to operate in parallel.
Scalar Processor Executes scalar data, can be simple or powerful depending on capabilities.
RISC and CISC Processor Two approaches to CPU design - RISC has a smaller, simpler instruction set while CISC has a larger and more complex one.
Digital Signal Processor Specialized microprocessor for high-speed mathematical operations on digital signals.
Symbolic Processor Designed for symbolic computation, manipulation of mathematical expressions using symbolic logic.
Graphics Processor Specialized microprocessor for accelerating rendering of 2D and 3D graphics.

For more information Resource Link

Microcontroller

A microcontroller (MCU) is a small computer on a single integrated circuit that is designed to control specific tasks within electronic systems. It integrates the capabilities of a central processing unit (CPU), memory, and input/output interfaces into one compact chip.
I took assistance to study the Microcontroller from the provided website.Resource Link Microcontrollers are widely used in embedded systems, such as home appliances, automotive systems, medical devices, and industrial control systems. They are also utilized in consumer electronics, including gaming consoles, digital cameras, and audio devices.


What is a microcontroller?

It's a small computer on a single chip.
It does tasks like processing, memory, and controlling other parts of a device.
It's commonly used in many things, from home appliances to gaming consoles.


What is inside a microcontroller?

It has a processor core for doing tasks.
Memory for storing data and instructions.
Input/output parts to interact with the world outside.
Communication interfaces to talk to other devices.


Microcontrollers use programming language?

we use programming languages like C, C++, and assembly language to write code for them.

Difference Between Microprocessor And Microcontroller



Memory

Embedded memory is like a mini-storage space inside a computer chip. It holds important stuff like instructions and data that the chip needs to work with. This memory can either be part of the chip itself, like in a microcontroller, or it can be a separate piece connected to the chip. It stores data temporarily while the chip is running and keeps instructions for the chip to follow. There are different types of embedded memory like ROM, RAM, and Flash Memory, each serving different purposes in making the chip work smoothly.

Importance Of Memory

Embedded memory is really important for electronic devices. It's like the device's brain, storing all kinds of important stuff. In things like phones, tablets, and smartwatches, it keeps the operating system, apps, and files safe.
In automotive systems, also need embedded memory. It stores the car's software, like how the engine works, and keeps track of data from sensors. In factories and other big machines, embedded memory is used to store instructions and data for controlling things and keeping an eye on what's happening. Embedded memory needs to work well to keep everything running smoothly. It helps devices and systems work fast by quickly getting the info they need.

Different Types Of Memories

Primary Memory

Primary memory is the stuff your device uses actively while it's on. It's like brain's working memory.

Secondary Memory

Secondary memory is like long-term memory, where we can store things for later but don't actively think about all the time.

Again, Two types of memories based on what happens when we turn off the power:

Non-volatile memory

This memory keeps its data even when turn off the power and stays there until you intentionally erase it.

Volatile memory

This memory loses its data when turn off the power. It is there while we are actively holding onto it, but once we let go, it's gone. For more information Refer Link Resource

The picture below illustrates the classification of embedded memory.



Primary Memory in Embedded Systems

Primary memory is the main memory in a computer that the processor directly uses. It's like the computer's short-term memory, holding onto data and instructions that are actively being used. There are two main types: RAM and ROM. RAM, or Random Access Memory, is where the computer stores data and instructions temporarily while it's running. It's fast but volatile. ROM, or Read-Only Memory, contains instructions that never change. It's used to store essential programs that the computer needs to start up, like the BIOS. Unlike RAM, ROM is non-volatile, meaning it retains its data even when the power is off.

RAM

Type Description Applications
SRAM Uses flip-flops for storage, faster access times, used as cache memory Cache memory in high-speed processors
NVRAM Retains data without power, used in automotive systems, initial processor instructions System firmware storage, calibration constants, passwords
DRAM Volatile memory, high density, lower cost, requires refreshing, used as main memory Main memory in electronic devices
SDRAM Operates with synchronous interface, higher data transfer rates, multiple memory operations Embedded systems, faster data transfer rates

ROM

Type Description Applications
MROM Mask ROM, programmed during manufacturing, cost-effective for large-scale production Firmware storage
PROM Programmable ROM, one-time programmable, requires ROM burner Firmware, low-level programs
EPROM Erasable PROM, retains data after power cycle, erased by UV light Updates to stored data
EEPROM Electrically erasable PROM, can be selectively erased and re-programmed electronically Frequent data modifications, in-circuit re-programming
Flash Memory Electrically erasable and programmable ROM, block/sector erase and re-programming Firmware storage, system booting, data storage

Secondary Memory in Embedded Systems

Secondary memory, also known as secondary storage or auxiliary storage, refers to storage devices in a computer system used for data storage. Unlike primary memory, they are not directly interfaced with the Microprocessor unit and can retain data without continuous power. These devices, typically non-volatile, offer higher storage capacities at lower costs compared to primary memory. Common examples include HDDs, SSDs, optical drives, magnetic tape, and external storage devices like USB drives or memory cards. Secondary memory is utilized for data backup, archival storage, file storage, and long-term data retention, providing a means to store and retrieve large volumes of data even when the system is powered off.

Device Description Applications
Hard Disk Drives (HDDs) Non-volatile storage, large storage capacity, relatively low cost Data backup, file storage
Solid-State Drives (SSDs) Non-volatile storage, faster access times than HDDs Data storage, system booting
Optical Drives (CD/DVD/Blu-ray) Read-only or read-write optical storage Data storage, media playback
Magnetic Tape Sequential access storage, used for data backup and archival storage Data backup, archival storage
External Storage Devices (USB drives, memory cards) Portable storage, plug-and-play connectivity Data transfer, file storage

Memory Components in Embedded Systems

Type Description Characteristics Applications
RAM (Random Access Memory) SRAM (Static RAM) Fast access times, no refreshing required Cache memory in high-speed processors
DRAM (Dynamic RAM) Higher density, lower costs, requires refreshing Main memory in embedded systems
NVRAM (Non-volatile Random Access Memory) Various technologies retaining data without power Storing critical system information like firmware BBRAM, EEPROM, FeRAM, MRAM, PCM
ROM (Read-Only Memory) Mask ROM Data programmed during manufacturing Essential firmware storage
PROM (Programmable ROM) Programmable once after manufacturing Early firmware prototypes
EPROM (Erasable Programmable ROM) Erasable and reprogrammable with specialized equipment Software development and testing
EEPROM (Electrically Erasable Programmable ROM) Erasable and reprogrammable electrically Embedded system configuration and updates
Flash Memory Reprogrammable, multiple write cycles USB flash drives, SSDs, firmware updates

Applications of Embedded Memory

Application Examples
Consumer electronics Smartphones, tablets, digital cameras, gaming consoles, smart TVs.
Automotive industry Infotainment systems, engine control units, ADAS, vehicle diagnostics.
Internet of Things (IoT) devices Smart home devices, wearables, industrial sensors, connected appliances.
Medical devices Implantable devices, patient monitoring systems, medical imaging equipment.
Aerospace and defense systems Avionics systems, radar systems, UAVs, communication systems.

Fuse

An electrical fuse is a safety mechanism designed to safeguard against excessive current in an electrical circuit. A key element of a fuse is a metal wire or strip that melts when the current surpasses a certain limit. This melting action interrupts the flow of electricity, thereby protecting the connected devices from damage. Different types of fuses are shown in below diagram from google. for more information Read article


Then In Individal Assignment task is to write a program for a microcontroller development board that I made in previous assignment, to interact (with local input &/or output devices).Here I documented all steps for programming microcontroller board.


Ardino IDE

Step 1: First I have installed Aurdino ide and open in my system


Step 2: Then I click on Tools > Board > Boards Manager and search RP2040 and install


Step 3: From google i got doc find useful for installation Ardino board. I click link inside doc for for Xiao RP2040 refer doc for installation Link Here


Click Yes to install Xioa RP2040 board

Step 4: Then I click on Tools > Board > Boards Manager and search RP2040 and install


Step 5: Then, I connected microcontroller Xioa RP2040 board with my system with data cable and then selected port


Step 6: Write Program for my microcontroller board in C++. In which i want to blink light one by one delay time 1 second.


This is about my microcontroller and program i create....

Thonny

Step 1:First install Thonny from google


Step 2: Check for the installation by printing the "Hello word"


Step 3: Then I Added micropython firmware by Pressing the BOOTSEL button and hold it for second I connected the other end of the micro USB cable to my computer.


Step 4: Now, my thonny environment is ready for write program in python.then i started to learn about how the program we write in python here we should know about the pin connection for led to turn on.also we should have data cable in good working condition otherwise we get problem to connect.Here we have to import time and pins.


In above program all LED blink at same time. then I tried for another program in which one by one led will blink


Thonny Programming
Thonny Programming

Keylearning:

In this week we learn about how to read datasheet, about Pin connections,what is microcontroller,types of microcontroller,specification of chips, how to write program in different environment and in different languages.

Original Files

  • Download Files