InterviewStack.io LogoInterviewStack.io

Peripheral Interfacing and Hardware Abstraction Questions

Basic understanding of common peripherals: ADC (Analog-to-Digital Converter), DAC (Digital-to-Analog Converter), timers, PWM (Pulse-Width Modulation), UART, SPI, I2C, GPIO. Knowledge of how to interface with these peripherals using registers or hardware abstraction layers. Understanding of communication protocols at a basic level.

MediumTechnical
75 practiced
Describe and provide pseudocode in C for configuring an SPI master peripheral to perform a full-duplex DMA transfer of N bytes (simultaneous TX and RX). Explain necessary DMA channel setups for TX and RX, which DMA/channel triggers to start first, how to synchronize completion, how to handle mismatched buffer sizes, and what cache maintenance is required if the MCU has a data cache.
MediumTechnical
91 practiced
Explain safe methods to protect shared data accessed by both ISRs and foreground (main) code in a bare-metal embedded system. Cover disabling/enabling interrupts, using atomic operations if supported, critical sections, using lock-free FIFOs/ring buffers, and considerations around nested interrupts and priority masking (e.g., NVIC/BASEPRI on Cortex-M). Provide short pseudocode for protecting a 32-bit counter updated in both contexts.
HardTechnical
72 practiced
You observe intermittent CRC errors on high-speed SPI transfers between an MCU and an external ADC. Provide a structured debugging approach: what electrical measurements to take (oscilloscope traces, eye diagrams), what firmware checks to perform (verify CPOL/CPHA, CS timing, DMA alignment), what hardware mitigations to try (series termination, drive strength, proper routing/grounding), and how to assess sources like jitter, crosstalk, or clock domain issues. Propose both quick mitigations and long-term fixes.
MediumTechnical
96 practiced
Implement in C an interrupt-safe circular (ring) buffer to receive UART bytes in a bare-metal environment. Requirements: fixed buffer size (no dynamic allocation), O(1) push/pop, safe concurrent access where ISR is producer and main context is consumer (no mutexes), and a reliable way to distinguish empty vs full. Provide the buffer struct and push/pop functions and explain volatile and memory-order considerations.
EasyTechnical
68 practiced
Explain hardware timers and counters in microcontrollers: common timer modes (up, down, up/down), prescalers, auto-reload/period registers, capture/compare channels, overflow/underflow interrupts, and typical uses such as event timing, input capture, PWM, and scheduling. Discuss how prescalers affect resolution and maximum measurable interval.

Unlock Full Question Bank

Get access to hundreds of Peripheral Interfacing and Hardware Abstraction interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.