PrajnaEdge
A curiosphere for curious minds who want to understand, experiment with, and experience technology.

Technology is a system of connections.

Modern technology is built from layers that continuously interact with one another. At the physical level, electronic devices transform electrical signals into digital information. Digital logic turns that information into computation, while processors, memory and communication interfaces provide the machinery needed to execute instructions and move data. As these components become part of embedded systems, they begin to interact with the physical world through sensors, controllers, actuators and real-time software.

But computation does not exist in isolation. Operating systems coordinate hardware and software, firmware gives specialized machines their behaviour, and communication protocols allow independent systems to exchange information. At the same time, machine learning is moving beyond the cloud into edge and on-device systems, where models must operate within real constraints such as memory, processing power, latency and energy consumption.

PrajnaEdge explores these connections as one continuous technology landscape — and takes them beyond explanation. From computing foundations and embedded systems to intelligent machines and edge AI, ideas can be understood, experimented with, and eventually turned into technology that can be experienced in the real world.

To continue exploring
Products

Technology, made tangible.

PrajnaEdge products and technology experiences are currently in development.
In Development

Playground

Experiment with intelligence beyond the cloud.

AI inference performed closer to where data is generated — optimizing model representation to reduce latency, memory footprint, and bandwidth requirements.
Cloud AI Coming Soon

Model Training & Representation

Explore how neural networks learn representations from data before compression and deployment. Future experiments will allow adjusting learning parameters—such as learning rate, epoch counts, and batch sizes—to observe loss trajectories and decision boundaries.

Edge AI Computer Vision

Image Classification

Can this image classifier maintain its intelligence while becoming small enough for the edge?

On-device AI AI-Thinker ESP32-CAM

On-device Image Classification

Run a fully quantized INT8 image-classification model directly on embedded hardware.

Edge AI Playground

Image Classification

Can this image classifier maintain its intelligence while becoming small enough for the edge?

Choose an image

Upload an image
Supports JPG, JPEG, PNG
This classifier recognizes only Apple, Banana, and Orange. Other objects may be incorrectly classified as one of these classes.

Choose the model

Model size
4.91 MiB
Largest activation
~625 KiB
Test accuracy
99.11%
Measured model accuracy
Your image is processed locally in your browser.
On-device AI · Inference

On-device Image Classification

Run a fully quantized INT8 image-classification model directly on embedded hardware.

This experiment investigates preparing a compact INT8 TensorFlow Lite model for direct inference on resource-constrained embedded hardware. The model uses the same CNN architecture as the Edge AI exploration, converted to a full INT8 representation to classify three classes: Apple, Banana, and Orange.

Model size
1.23 MiB
INT8 quantized weights
Model accuracy
99.11%
Measured test accuracy
Target hardware
AI-Thinker ESP32-CAM
Embedded microcontroller target

Explore the ideas, systems and connections that shape technology — choose any node to begin your journey.

PrajnaEdge Navigation Tree
Embedded Systems Tree
View Books →
PrajnaEdge Library

PrajnaEdge Library

Practical guides to embedded systems and engineering.

CAN Bus Debugging: From Symptoms to Root Cause Book Cover
Automotive · Embedded Protocol Debugging

CAN Bus Debugging: From Symptoms to Root Cause

  • Select
  • United States
  • United Kingdom
  • Germany
  • France
  • Spain
  • Italy
  • Netherlands
  • Japan
  • Brazil
  • Canada
  • Mexico
  • Australia
  • India

Edge AI Demonstrations

Deploying neural networks and intelligent decision loops on raw silicon targets.

Sort:
Bare Metal

The Infinite Loop That Runs a Machine

Why embedded programs enter a loop they never intend to leave.

Bare MetalSuperloopLatencyPollingInterrupts

1. The Lifetime of the Application

In desktop or server application development, an infinite loop is a critical failure. It is the signature of a frozen UI, a runaway process consuming 100% CPU, or a logical bug that requires an immediate process kill. Desktop applications are guests in an operating system; they run, complete their task, and yield control back to the host.

But inside a bare-metal microcontroller, there is no host. The firmware is the operating system. If execution reaches the closing bracket of the main() function, the program counter falls off a digital cliff. It enters an undefined state, executing whatever random instructions happen to reside in the adjacent flash memory. To keep the machine alive, execution must never end. The infinite loop is not a programming mistake — it is the lifetime of the application.

In bare metal, an infinite loop is not a bug. It is the structural guarantee that the machine remains itself.

2. Initialization Happens Once

Every bare-metal application is divided by a clean temporal boundary: code that executes once during boot, and code that executes repeatedly forever.

Consider this conceptual skeleton of a system:

int main(void) { /* One-time initialization */ System_Init(); Peripheral_Init(); /* Continuous execution */ while (1) { // Application runs here } }

Before entering the loop, the CPU configures oscillators, sets pin directions, clears memory segments, arms interrupt lines, and initializes peripheral registers. Once this stage finishes, the system steps across the threshold into continuous execution, performing its duties inside the infinite loop.

BARE-METAL SYSTEM EXECUTION LIFE CYCLE
POWER / RESET Application Startup One-Time Init SUPERLOOP (while(1)) OBSERVE (Read Inputs) DECIDE (Process) ACT (Outputs) Repeat Indefinitely
The system boots and initializes once, then commits to an infinite cycle of reading, thinking, and acting.

3. The Superloop Architecture

The simplest bare-metal design pattern is the Superloop. In this structure, all application operations reside sequentially inside the infinite loop. The CPU cycles through these tasks in a strict, repetitive order:

while (1) { ReadInputs(); ProcessInputs(); UpdateOutputs(); }

Over time, this means the execution runs as a linear sequence:

- Iteration 1: Read → Process → Update - Iteration 2: Read → Process → Update - Iteration 3: Read → Process → Update

Because the processor has only one core executing a single instruction stream, it cannot perform these operations simultaneously. It is a strictly sequential machine, cycling through the tasks as fast as the clock ticks allow.

4. The Hidden Property: Loop Latency

As long as the tasks inside the loop are small and fast, the system is highly responsive. But as features accumulate, the loop stretches. Consider a more complex superloop:

while (1) { ReadButton(); ReadSensor(); ProcessData(); UpdateDisplay(); SendCommunication(); }

Every function added introduces execution time. The total time taken to complete a single iteration of the loop—the loop latency (Tloop)—is the sum of all individual task execution times:

Tloop = Tbutton + Tsensor + Tprocessing + Tdisplay + Tcommunication

If SendCommunication() has to wait for a buffer to clear, or ProcessData() performs floating-point math, the loop stretches. If Tloop reaches 50 milliseconds, then ReadButton() is only checked once every 50 milliseconds. If the user presses and releases a button in 30 milliseconds while the CPU is busy updating the display, the press is missed completely. The structure of the loop itself defines the latency of the system.

SUPERLOOP LATENCY COMPARISON
CASE A: Fast & Balanced Loop (Low Latency) Read Process Update Read Process Update Read Time → CASE B: Blocking Loop (High Latency/Stretched Interval) Read BLOCKING DELAY / SLOW PERIPHERAL WAIT (1000ms) Update Read Time →
Any single blocking task stretches the loop period, delaying all subsequent reads and updates.

5. The Cost of Blocking Code

Many simple tutorials instruct developers to handle timing like this:

while (1) { ReadInputs(); DelayMs(1000); // wait 1 second UpdateOutputs(); }

During DelayMs(), the CPU enters a blocking loop, executing thousands of empty assembly instructions simply to waste time. During this time, the foreground superloop is frozen. It cannot read sensors, process communications, or handle calculations. While hardware interrupts can still temporarily preempt this delay to run brief routines, the main loop remains paralyzed.

A more common, structural form of blocking occurs when waiting for peripherals:

while (1) { WaitForSensor(); // Spin-waits for a hardware flag ProcessCommunication(); UpdateDisplay(); }

If the sensor breaks, disconnects, or pulls its line low indefinitely, the processor spins inside WaitForSensor() forever. The communication and display tasks never execute. This vulnerability demands that bare-metal developers design code to avoid passive waiting.

6. Polling: The Active Interrogation

The simplest way a superloop interacts with hardware is Polling. In a polling model, the processor actively and repeatedly checks a register flag or GPIO pin to see if a condition has met its criteria:

while (1) { if (Button_IsPressed()) { LED_Toggle(); } }

The processor is in a state of constant interrogation. It reads the input port register, compares the bits, and takes action. Polling has major advantages: it is simple, predictable, and requires no complex concurrency tools. But in larger systems, its drawbacks become severe. The CPU consumes maximum power running check loops, and the latency to detect an input remains directly tied to the cycle speed of the rest of the loop.

7. Interrupts: Breaking the Chain

To bypass the latency limits of polling, processors use Interrupts. An interrupt is a hardware-triggered event that forces the CPU to temporarily suspend its current execution flow, save its registers to the stack, and branch directly to an Interrupt Service Routine (ISR) mapped in the vector table.

THE FOREGROUND-BACKGROUND SYSTEM MODEL
FOREGROUND EXECUTION (Main Superloop) Task 1: Math Task 2 IRQ Preemption Return to Main Task 3: Display BACKGROUND EXECUTION (Asynchronous Interrupt Service Routines) Peripherals Sleep / CPU Idle USART1_IRQHandler()
Hardware interrupts preempt the foreground execution flow instantly, run briefly, and restore main loop execution context.

By delegating observation to peripheral hardware—such as configuring a UART module to raise an interrupt only when a byte arrives—the CPU can spend its foreground cycles on main loop calculations, safe in the knowledge that urgent events will break through instantly.

8. The Handoff: Interrupt to Superloop

Because interrupts preempt foreground code, a critical design rule applies: keep ISRs short and bounded. An ISR should never print to a screen, process long packet arrays, or block inside delay loops. If an ISR runs too long, it starves other interrupts, causing data loss and system degradation.

To resolve this, systems use a split handoff model. The ISR (background) detects the hardware condition, registers it, and yields immediately. The main loop (foreground) processes the actual work at a lower priority level:

volatile bool data_ready = false; void Some_IRQHandler(void) { data_ready = true; // Signal the event } int main(void) { Initialize(); while (1) { if (data_ready) { data_ready = false; ProcessData(); // Perform heavy execution here } } }

This architecture decouples the physical notification of the event from its computational execution. It requires careful concurrency practices—such as marking shared indicators as volatile to prevent compilers from optimizing away register reads—but it keeps the system both responsive and stable.

9. Foreground and Background Work

By combining a sequential superloop with asynchronous interrupts, a simple bare-metal application builds a dual-execution model:

1. Foreground: The main loop runs non-urgent application work, scheduling processes and updating slow states. 2. Background: Interrupt routines handle urgent hardware events, copying data packets, and signaling flags.

While the CPU core still executes a single instructions stream per instant, interrupts multiplex the execution context, creating a coordinated priority system directly on the silicon.

10. The Problem of 'When'

We have answered our opening question: the infinite loop is the lifetime of the application, keeping the processor running and scheduling work.

But as applications grow, a new problem emerges: timing. Suppose our system needs to: - Read a button status frequently (every 1 ms) - Sample a temperature sensor occasionally (every 10 ms) - Update a low-power screen display periodically (every 100 ms) - Transmit a network package slowly (every 1 second)

Simply grouping all of these tasks inside one while(1) block means they all run at the same arbitrary, frequency-dependent speed of the loop. An infinite loop gives the machine repetition. It does not automatically give it time. To resolve this, we must teach our loop how to measure cycles, divide frequencies, and schedule its promises.

The Eternal Engine

The infinite loop is the eternal engine of the bare-metal machine. It keeps the core executing, coordinates peripherals, and acts as the canvas upon which interrupts paint asynchronous events.

A loop can repeat forever. But to make that repetition useful, we must learn to structure it.

A processor without a loop is a spark that goes out. The loop makes it a flame.
System Tree Node Bare Metal

PrajnaEdge

Engineering concepts you don't just read — you experience.
Founded in 2026.

PrajnaEdge is a technology company exploring the space between understanding technology, experimenting with ideas, and turning them into things that can be experienced.

Our Mission

To make technology easier to explore, deeper to understand, and more exciting to experience.

Our Vision

To build a technology ecosystem where curiosity, experimentation and creation continuously lead to one another.

Where it began

Embedded Systems

PrajnaEdge began with Embedded Systems — exploring the foundations that connect hardware, software and intelligent computation.

The first technology universe is built around that foundation. The journey will expand as new ideas, experiments and products emerge.

PrajnaEdge is a technology company created by Devaharsha Meesarapu.

CREATOR PROFILE

Devaharsha Meesarapu

Embedded Systems • Firmware • Edge AI

I am the engineer behind the design, development, and content of PrajnaEdge. I build low-level systems where code directly controls hardware, bridging the gap between register-level silicon behavior and intelligent edge decision loops.

View Resume →

ABOUT ME

I am an Embedded Firmware Engineer focused on developing software for resource-constrained systems. My experience spans bare-metal firmware, device drivers, microcontroller peripherals, and communication protocols, working across the boundary between hardware and software.

My work has involved microcontroller-based systems, real-time behaviour, hardware interfaces, and communication technologies such as CAN, CAN FD, UART, SPI, and I²C. I am particularly interested in understanding systems from the lowest level upward—from registers and peripherals to intelligent edge systems.

ENGINEERING PHILOSOPHY

Engineering is not just about writing code; it is about managing constraints, timings, and physical hardware characteristics. True mastery of complex systems comes from understanding the interactions across different layers of the stack.

This conviction is why I built PrajnaEdge—to bridge the gap between conceptual theory and direct, register-level physical reality.

CONNECT

LinkedIn → GitHub →

Interactive Career Journey

BTech · ECE

Foundations

Where it all began — understanding the physical layer of computation. Circuits, signals, and systems gave me a mental model of how information moves through hardware.

⬡
Connects to Systems
Understanding circuits directly enables writing firmware that talks to peripherals at the register level.
What it is
BTech in Electronics and Communication
Undergraduate foundation covering analog & digital circuits, signal processing, microprocessors, and communication systems.
CircuitsSignal ProcessingMicroprocessorsVLSI
What I did
Core Engineering Fundamentals
Studied semiconductor physics, digital logic design, and embedded microcontrollers. Built prototypes using 8-bit MCUs.
8051Logic DesignPCB Basics
What I learned
The Hardware Mental Model
Every software abstraction sits on physical reality. Understanding silicon teaches you why timing, power, and noise are first-class engineering problems.
Let's Connect
Interested in embedded systems, AI, or building something meaningful? I'd love to hear from you.
Open to collaborations, research, and interesting engineering conversations.
Help Improve PrajnaEdge
Found something to improve? I'd love to hear your thoughts.

Bare Metal

Software that runs directly on hardware without an operating system.

Applications
↑
Operating Systems
YOU ARE HERE
Bare Metal
Processor
↑
Hardware

"Every embedded application begins long before main()."

Operating Systems

An Operating System manages hardware and software resources so complex applications can work efficiently.

Applications
↑
YOU ARE HERE
Operating Systems
Bare Metal
↑
Processor
↑
Hardware

"When one loop is no longer enough to carry the burden."

← Return to Systems Tree
Select Domain
Explore application domains branching from the Systems Tree
Automotive
Aerospace & Defence
Consumer
Embedded AI
Industrial
Medical
Multimedia
Network & Connectivity
Robotics
Explore Active Systems Tree →
← Return to Systems Tree
Select Depth
Examine computation through architectural depth layers
Architecture
Controller
Digital
Programming
Processor
Explore Processors → Explore Controllers →

Support PrajnaEdge

PrajnaEdge is an independent education platform built to make knowledge freely accessible.

If you find PrajnaEdge useful, you can support its continued development.

Your support helps fund the time, tools, infrastructure, and experimentation that go into building and maintaining PrajnaEdge.

Select Region
Select Amount
Select an amount to support PrajnaEdge.