Peripheral Interfaces and Serial Communication Protocols Questions
Wiring firmware to hardware through digital and serial buses such as GPIO, I2C, SPI, UART, CAN, and USB. Covers protocol framing, addressing, clocking, bus arbitration, and driver-level integration with peripheral registers. Includes debugging bus-level communication failures and choosing the right interface for a device.
Design a deterministic low-latency scheduler in firmware that arbitrates access to multiple serial interfaces (UART, SPI, I2C) on a single MCU to satisfy real-time tasks. Include priority assignment, preemption rules, buffer ownership, and how to guarantee worst-case latencies under load.
A shared peripheral control register REG_CTRL is accessed by both main code and an ISR. Main needs to set bits 6–7 together without disturbing bits that may be independently modified by the ISR. The MCU lacks atomic bit-set hardware instructions. Design a robust strategy to update bits 6–7 safely on a Cortex-M with nested interrupts, and provide example C code that minimizes interrupt latency while avoiding races. Consider interrupt priorities and alternatives like separate set/clear registers.
A vendor supplies a large HAL and driver library for a peripheral but lacks one feature you need. You must add it while keeping the codebase maintainable across vendor updates. Outline options: patch vendor code, wrap it with an adapter layer, or write a new driver. For each option, discuss maintainability, ease of upstreaming, risk of merge conflicts, versioning strategy, and your recommended test strategy to ensure vendor updates don't regress your changes.
What is Direct Memory Access (DMA)? Explain typical DMA use-cases in embedded systems, the relationship between DMA and device drivers, and basic DMA concepts such as channels, descriptors, scatter-gather, circular mode, and synchronization with CPU and cache. Also outline common pitfalls when enabling DMA on microcontrollers.
A device using UART at 921600 baud intermittently drops bytes when traffic is heavy. Describe a step-by-step debug plan: what to inspect in firmware (ISR length, buffer/FIFO sizes), hardware (signal levels, level shifters), peripheral configuration (FIFO thresholds, DMA), and what tools to use (logic analyzer, oscilloscope). Propose likely fixes and trade-offs (e.g., enabling DMA vs increasing interrupt priority).
Unlock Full Question Bank
Get access to all Peripheral Interfaces and Serial Communication Protocols interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.