YURUNOX / Embedded control essentials

What Is a Microcontroller? How MCUs Work

Direct answer: A microcontroller (MCU) is a programmable chip that combines a CPU core, memory and hardware peripherals. Firmware tells it how to read inputs, meet timing requirements and control external circuits. To choose one, verify the exact part and package against the product's workload, memory, pin, electrical, power, programming and lifecycle requirements.

A board feature is not automatically an MCU feature, and the same CPU core does not guarantee compatible pins or firmware. Mixing those scopes can create an incomplete specification, a failed prototype or an unapproved substitute.

By YURUNOX · For engineers, electronics learners and technical buyers
Sources reviewed

ATmega328P-PU microcontroller in a through-hole package, shown as a standalone chip
This is the MCU component, not a complete controller board. Power, interfaces and suitable firmware are still needed. Photo: oomlout, Wikimedia Commons, CC BY-SA 2.0. Uncropped; package illustration, not a purchasing recommendation.

What Is a Microcontroller, and How Is It Different From a CPU or Development Board?

MCU means microcontroller unit. The CPU, or central processing unit, is the part that executes instructions. The MCU adds memory and hardware interfaces around that core.

Firmware is the software that gives the device its behavior. A development board adds supporting circuits, connections and sometimes a programmer/debugger to make an MCU easier to use.

For a new design, define the inputs, outputs, response deadlines, memory needs and power budget first. Clock speed alone does not establish suitability.

Quick MCU decision map
Available informationProvisional interpretationEvidence required nextStop boundary
Only a board name or photoThe complete board, not the MCU, has been identifiedBoard schematic/BOM and exact MCU ordering codeDo not copy board features into a bare-chip RFQ
Only a CPU core and clock rateProcessing architecture is partly definedMemory, peripherals, package, pins and electrical limitsDo not approve the device from performance labels alone
Exact MCU and packageA device-level review can beginDatasheet, reference manual, errata, tool and lifecycle checksHold if a required function or condition is unsupported
Proposed substituteA redesign candidate, not a drop-in replacementPin map, electrical comparison, firmware port and validation planEngineering approval is required before production use

ST's MCU introduction describes this integration of processing, memory and peripherals. It makes an MCU useful for embedded systems: electronics built into a larger product to do particular jobs.

A thermostat can read a temperature sensor, compare the reading with a setting and signal a load-control circuit. An instrument can measure, display and report a value. Those behaviors are designed into the hardware and firmware; the chip does not automatically know what the product should do.

When Does an MCU Fit Better Than a Microprocessor?

An MCU is a natural starting point for a bounded control task. A microprocessor-based platform may be more suitable when the product needs a large operating system, extensive external memory or a complex application interface. The categories overlap, and a product can use an MPU for its interface and an MCU for dedicated control.

Compare the memory arrangement, software environment, startup behavior and supporting circuitry. Avoid treating “MCU” as a guarantee of low cost, or “MPU” as a guarantee of fast response.

02 / Inside the chip

Which MCU Resources Determine What the Device Can Do?

Separate three jobs: processing instructions, holding information and interacting with the outside world. The available blocks vary by device and package; not every MCU includes every feature below.

MCU resources and the questions they answer
BlockIts jobWhat to check
CPU coreExecutes instructions and calculationsWorkload and response deadlines
Program storageHolds application instructionsFirmware size and update arrangement
RAMHolds working data and stacksBuffers, tasks and peak usage
GPIOReads and drives digital signalsPin assignment and electrical limits
Timers / countersMeasure time or events; generate pulsesClocking, capture and PWM capability
Analog peripheralsConvert or compare analog signalsAccuracy, input range and sampling needs
CommunicationExchanges data with other devicesProtocol, pins and physical interface
Clock / reset / supervisionCoordinates operation and recoveryStartup, fault response and low-power behavior

Use this as a resource map, not a feature wish list. A required function must exist, fit the selected package and remain available when the other functions are enabled.

Do CPU Width, Clock Speed, and ADC Resolution Measure the Same Thing?

An 8-bit, 16-bit or 32-bit label describes aspects of the processor's data architecture. It is not the pin count or analog measurement resolution. MHz describes clock cycles per second, not universally completed instructions per second. Memory access, instruction choice and peripherals affect useful performance.

Where Do Flash and RAM Serve Different Roles?

Internal nonvolatile Flash, which retains information without power, is common for firmware but not universal. RAM (random-access memory) holds changing data, communication buffers and the stack used by function calls and interrupts. More Flash cannot compensate for insufficient RAM.

Settings that must survive power loss need an appropriate nonvolatile store, such as EEPROM, Flash or external memory. Review write endurance and interrupted-write recovery. Ordinary RAM should not be assumed to retain data after power is removed.

What Electrical Limits Apply to Pins and Peripherals?

GPIO means general-purpose input/output. Many pins can instead connect to a peripheral through an alternate-function setting. Two desired functions may compete for the same pin even when the chip advertises both.

An analog-to-digital converter (ADC) converts an analog input to a digital reading. A digital-to-analog converter (DAC), when present, produces an analog output. ADC resolution is not the same as measurement accuracy: the reference, input circuit and noise also matter.

Common communication options include UART for asynchronous serial data, SPI for clocked serial communication and I2C for a shared clock-and-data bus. Some MCUs add USB, CAN, Ethernet or wireless hardware. A protocol controller does not necessarily include its external transceiver or all the circuitry required at the connector.

03 / How MCUs work

What Happens From Power-On to Useful Control?

Power and reset establish the starting condition, startup code prepares the software environment, firmware configures the required hardware, and the application then responds, repeats or sleeps. The exact boot path remains device- and configuration-specific.

  1. Power and reset establish the starting condition

    The MCU follows its configured boot path once the supply and reset conditions permit operation. That path may start an application or enter a bootloader, which is software for loading or selecting an application.

  2. Startup code prepares the software environment

    For an Arm Cortex-M example, CMSIS documents a reset handler, system initialization and entry into the language runtime before the application's main function. This is architecture-specific, not a universal boot script.

  3. Firmware configures the needed hardware

    Initialization sets clocks, pin functions, timers, communication rates and event handling. Drivers often hide the register details, but the underlying configuration still determines which hardware works.

  4. The CPU executes; peripherals do recurring work

    The CPU conceptually fetches, decodes and executes instructions. Configured timers can generate pulses or capture events without software manually timing every edge. Where supported, direct memory access (DMA) hardware moves data between peripherals and memory without the CPU copying every item.

  5. The application responds, repeats or sleeps

    Firmware processes events in a loop, interrupt handlers or scheduled tasks. It may enter a low-power mode between jobs, provided the required wake sources and state are preserved.

Peripherals are more than connectors. Microchip's core-independent peripherals illustrate hardware that can operate without constant CPU attention. The exact capability and low-power behavior must be checked for the selected device.

A timer's pulse-width modulation (PWM) output varies the active proportion of each digital pulse period. PWM is not inherently an analog voltage; a suitable filter or load can respond to its average effect. It is also not a power driver for a motor or relay coil.

04 / Inputs, events and deadlines

How Does an MCU Capture Events Without Missing Them?

An MCU avoids missed events only when its polling interval, interrupt behavior or hardware capture path is validated against the shortest valid event, highest event rate and required response deadline.

Three ways to respond to the outside world
ApproachWhat happensMain limitation to review
PollingSoftware repeatedly checks a signal or statusDelay and missed events between checks
InterruptAn enabled event requests a handlerMasking, priority and handler execution time
Peripheral timingHardware counts, captures or generates eventsInput, clock, counter and buffering limits

An interrupt service routine (ISR) usually records urgent information and leaves longer work to application code. Interrupt latency is the delay before handling begins, not the complete response time. Arm's explanation shows why memory conditions, competing interrupts and software work matter beyond a headline cycle count.

Illustrative timing example / Not measured hardware

Why Can a Fast MCU Still Miss a Short Pulse?

Suppose firmware checks a raw digital input every 5 ms. A sensor pulse begins at 1.0 ms and ends at 1.8 ms. Both scheduled reads see a low signal, so this polling scheme misses the event.

  1. 0.0 msRead input: low
  2. 1.0 msPulse begins
  3. 1.8 msPulse ends
  4. 5.0 msRead input: low

What changes the design: evaluate a suitable edge interrupt, counter or capture peripheral, or change the sampling strategy. Hardware still has minimum pulse-width and rate limits; an interrupt flag does not necessarily queue every arriving event.

How Should an Input Event Be Traced Through a Complete Control Path?

Imagine a controller that counts cartons and signals when a batch is complete. This is a hypothetical teaching example, not a YURUNOX installation or a safety-control design.

  1. Sensor detects cartonExternal sensor
  2. Condition the signalExternal interface and protection
  3. Capture the eventMCU input / timer / interrupt
  4. Validate and countApplication firmware
  5. Issue a control signalMCU output
  6. Drive the indicatorSuitable external load circuit

A hypothetical 24 V sensor output must not be connected directly to an MCU input without verifying and designing the interface. Likewise, a GPIO signal cannot be assumed to supply a relay coil or motor. Check voltage, current, protection and reset-state behavior at both boundaries.

Define what counts as one carton: a valid pulse, a complete high-to-low cycle or another accepted pattern. Noise and repeated edges can inflate a count; excessive filtering can erase real short events. Check the waveform at minimum and maximum operating speeds.

Ask for evidence: the input waveform, valid-event rule, maximum burst rate and worst-case time to finish the response. “Real-time” means meeting a specified deadline, not simply having a high clock frequency.

05 / Real hardware, different choices

What Do Real MCU and Development-Board Specifications Mean?

Real specifications must be read at the correct entity level: chip, package or complete board. The documented examples below show why CPU width, internal memory and board-added functions must remain separate selection dimensions.

CPU architecture and memory are separate selection dimensions
DeviceCPUProgram storage / working memory
ATmega48098-bit AVR48 KB Flash / 6 KB SRAM
STM32F103C832-bit Arm Cortex-M364 Kbytes Flash / 20 Kbytes SRAM
RP2040Two 32-bit Arm Cortex-M0+ coresExternal application Flash / 264 kB main SRAM

Read across each row, not down a ranking. More CPU bits do not fix a missing interface, and two cores do not automatically double performance. Memory capacities follow the manufacturers' terminology; confirm the exact ordering code and memory map.

Top view of an original Raspberry Pi Pico board showing its RP2040 chip and separate supporting components
The original Pico is a board built around RP2040. Its external Flash is a separate component, not memory inside the MCU. Photo: Michael H. (“Laserlicht”), Wikimedia Commons, CC BY-SA 4.0. Resized, uncropped.
Documented board example

What Does the Pico's 2 MB Flash Mean for RP2040?

Raspberry Pi documents the original Pico board with 2 MB of on-board Flash. The RP2040 chip has no built-in application Flash and can execute code through its external Flash interface.

The practical lesson: copying a board's headline memory figure into a bare-chip RFQ creates an incomplete requirement. A custom design must account for program storage, its connections and the boot arrangement.

Documented board example / Arduino

What Does the Nano Every's USB Port Actually Represent?

The Nano Every datasheet describes an ATmega4809 main MCU and a separate SAMD11D14A processor. The latter provides a USB-to-serial bridge and handles firmware programming through UPDI.

The practical lesson: a board-level feature can come from a second chip. Before replacing a development board with a custom PCB, identify which MCU, bridge, regulator and interface circuits supply each feature. Buying only the main MCU does not reproduce the board.

06 / Software meets hardware

How Is Firmware Programmed and Debugged?

Firmware is normally compiled and linked for the exact target, programmed through a supported probe or bootloader path, and verified on the intended hardware. The image, programming settings, target MCU, debug interface and tool versions must be controlled together.

STM32 Value Line Discovery board with its ST-LINK section, target MCU, buttons and pin headers
A development board makes programming and signals accessible. This documented STM32 Value Line board includes both a target MCU and ST-LINK circuitry. Photo: Viswesr, Wikimedia Commons, CC BY-SA 3.0. Uncropped; not a current tool recommendation.

Which Programming and Debug Hardware Does the Target Need?

ST's STM32VLDISCOVERY documentation identifies an STM32F100 target and an integrated ST-LINK programmer/debugger. The board's USB connection should not be mistaken for a USB application feature of that target MCU.

For your own PCB, preserve the required programming/debug access and verify the actual tool, target and software versions together. A familiar connector alone does not establish compatibility.

Does an MCU Need an Operating System?

No. A bare-metal application can use a main loop and interrupts. A real-time operating system (RTOS) can organize tasks, shared resources and scheduling, but adds memory and design work. Neither approach removes the need to check deadlines.

For production, control the firmware version, programming settings and verification procedure. Plan authentic updates, debug-access policy and recovery from interrupted programming where those requirements apply.

The same CPU core does not mean the same firmware image. Peripheral registers, memory maps, pins and startup behavior can differ. Source code may be portable after changes; a compiled production image is not automatically interchangeable.

07 / Power over a complete cycle

How Do Active and Sleep States Affect Average Current?

Average current depends on the current in every operating state and the time spent in each one. A very low sleep-current specification does not establish board consumption when active time, wake transitions, regulators, sensors or communication loads dominate the cycle.

An MCU can save energy by sleeping between jobs and disabling unused functions. The relevant low-power mode must preserve the necessary memory, peripherals and wake sources. Microchip's AN2515 examples show peripherals that can examine events without waking the CPU for every one.

For a simple two-state estimate, weight each current by the time spent in that state. Use values measured at the same supply rail; mixing currents from different voltages does not establish battery current.

Average current = (active current × active time + sleep current × sleep time) ÷ total time

Assume 8 mA for 10 ms and 8 µA for the remaining 990 ms of a one-second cycle. Convert 8 µA to 0.008 mA: (8 × 10 + 0.008 × 990) ÷ 1,000 = 0.08792 mA, or 87.92 µA.

These are invented operating assumptions, not specifications or measurements of the devices above.

Illustrative planning tool Estimate an active / sleep current cycle

Change the assumptions to see how active time affects average current. Entries are not sent or stored by this tool.

Modeled average current
87.92 µA
Time spent active
1%

Active-state contribution: 80 µA. Sleep-state contribution: 7.92 µA.

Assumes two constant-current states at one measurement rail. Excludes transitions, regulator losses, battery behavior and any external loads not included in the inputs. This is not a battery-life prediction.

The useful insight: in this example the brief active period contributes 80 µA of the 87.92 µA average. Reducing sleep current alone leaves most of that average unchanged. Measure the complete board: a radio, sensor, regulator or indicator can dominate the result.

08 / From application to exact part

How Should an MCU Be Chosen for a Product?

Choose an MCU by mapping the product's real work and deadlines to the exact device and package, then validating memory, pin coexistence, electrical limits, power modes, firmware tools and maintenance requirements together.

  1. Specify the work and its deadlinesList measurements, calculations, communication and response times. Test the demanding combination, not only an isolated demo.
  2. Budget program storage and RAM separatelyInclude libraries, buffers, task stacks, logs and the planned update method. Check peak use and leave justified headroom.
  3. Prove that pins and peripherals coexistComplete a pin assignment for the actual package, including debug access. Resolve shared-pin and peripheral conflicts before ordering.
  4. Check electrical and environmental limitsReview supply range, input thresholds, analog conditions, pin and package current limits, temperature and surrounding protection.
  5. Validate power, software and support togetherConfirm the duty cycle, wake behavior, tools, libraries, errata, security needs and maintenance plan under realistic conditions.

Read the datasheet for electrical characteristics and pins, the reference manual for peripheral behavior, and the errata for known limitations. A family feature list may describe more than the particular package or device you are buying.

09 / Practical failure checks

What Should Be Checked When an MCU Board Does Not Start?

A silent board should be treated as a system-level fault until the supply, reset, boot selection, programmed image, clocks and initialization path have been checked at the device. Silence alone does not prove the MCU is defective.

Start with evidence in a useful order: supply at the device, reset state, boot selection, programmed image and required clocks. Then check whether execution reaches initialization and whether the intended pin functions are enabled.

If the fault is intermittent, capture supply behavior, reset-cause information and communication traces. Change one relevant variable at a time. A debugger can affect timing and low-power behavior, so repeat the failing operating condition without it attached.

What Should Be Investigated After Repeated Watchdog Resets?

A configured watchdog can detect some failures when software stops servicing it. It cannot prove correct behavior or system safety. Determine whether the application is blocked, starved, corrupted or resetting for another reason, and review what the outputs do during recovery.

For the conveyor example, a reset that clears the count is a product requirement issue as well as a software issue. Decide whether the count must be retained, how interrupted updates are handled and how the operator learns that counting was interrupted.

10 / Sourcing and substitution control

What Evidence Is Required Before Sourcing or Substituting an MCU?

A sourcing decision should identify the exact manufacturer part number, package and grade, then preserve the documents and engineering checks that prove the device fits the approved hardware and firmware. A family name, matching CPU core or similar package outline is not enough.

Evidence-to-action guide for an MCU request
Request conditionEvidence requiredRecommended actionStop boundary
Exact approved partFull ordering code, approved manufacturer documents, quantity, date need and traceability termsRequest availability and commercial review for that exact partHold if suffix, package, grade or requested evidence is ambiguous
Programmed MCUControlled firmware image, device configuration, programming method and verification criteriaUse a separately approved programming and traceability processDo not send uncontrolled firmware or assume blank-part supply includes programming
Proposed substitutePin-by-pin, electrical, peripheral, memory, boot, toolchain and lifecycle comparisonRun hardware and software validation before engineering approvalDo not treat a matching core, memory size or outline as drop-in proof
Board-to-custom-PCB transitionBoard schematic/BOM and ownership of memory, USB, regulator, debugger and protection functionsTranslate every board function into an identified chip or circuitStop if a required board-added function has no implementation

Which Inputs Make an MCU RFQ Reviewable?

Provide the complete manufacturer part number, package and grade, quantity, target build and delivery dates, traceability requirements and any approved date-code or packaging constraints. State whether parts are expected blank or whether a separately agreed programming service is needed. Include companion memory, power, clock and interface parts when they determine whether the build can proceed.

For brand-specific enquiries, start with STMicroelectronics component sourcing or Renesas component sourcing. Review YURUNOX Quality Assurance for the evidence and inspection discussion.

When Is a Proposed MCU Substitute Not Ready for Approval?

It is not ready when the exact pin assignment, power and I/O limits, peripherals, memory map, boot behavior, programming route, compiled firmware, errata or product qualification plan remains unresolved. Engineering should own the substitution decision and keep the comparison plus validation results with the approval record.

From an approved design to a clear sourcing request Send an exact MCU part number or component BOM

Send YURUNOX the ordering codes, quantities, package and grade requirements, target dates, traceability needs and any controlled programming requirement. YURUNOX supports electronic-component sourcing; your engineering team should confirm electrical fit, firmware compatibility and any alternative.

11 / Primary evidence

Which Primary Sources Should Be Rechecked for the Selected Device?

Recheck the current product page, datasheet, reference manual, errata, ordering information and applicable programming-tool documentation for the exact MCU and package. The sources below support the explanations and documented examples, but they do not approve a different part or establish current inventory.

Device and board examples come from manufacturer documentation. The conveyor, pulse timing and current model are illustrative, not reported tests or YURUNOX customer projects. Exact ordering codes, revisions and operating conditions still require their own review.

  1. STMicroelectronics: STM32 MCU basicsDefinition, principal resources and the roles of datasheets, reference manuals and errata.
  2. Arm CMSIS-Core: Cortex-M startup fileCurrent CMSIS 6 documentation for the reset handler, initialization and entry into application code; architecture-specific.
  3. Arm: A Beginner's Guide on Interrupt LatencyJoseph Yiu, 2016. Interrupt entry timing and the limits of headline latency figures.
  4. Microchip: Core Independent and Analog Peripherals and AN2515 peripheral examplesHardware work without constant CPU attention and selected low-power event behavior.
  5. Microchip: ATmega4809 product documentation and ST: STM32F103C8Current product-level documents and memory configurations; not interchangeability evidence.
  6. Raspberry Pi: Microcontroller chips and Pico boardsRP2040 architecture and the original Pico board's separate Flash memory.
  7. Arduino Nano Every datasheetMain MCU, USB bridge processor and programming arrangement; sections 3.2 and 3.3.
  8. ST: STM32VLDISCOVERYDocumented development-board example with a target MCU and integrated programmer/debugger; tool compatibility still requires a current check.

Image credits and licenses are shown below each photograph. Third-party names and images do not imply affiliation or endorsement.

Back to top ↑
Cart (0 items)