5.5.5 · D1 · HinglishEmbedded Systems & Real-Time Software

FoundationsCommunication interfaces — UART, SPI, I2C (master - slave), CAN bus

2,199 words10 min read↑ Read in English

5.5.5 · D1 · Coding › Embedded Systems & Real-Time Software › Communication interfaces — UART, SPI, I2C (master - slave),

Ye page — bilkul zero se — har wo symbol, term aur picture build karta hai jis par parent topic depend karta hai. Upar se neeche padho: har idea ek eent hai jis par agla idea khada hota hai.


0. Ek wire ek voltage-over-time graph hai

Kisi bhi protocol se pehle, samjho ki ek wire hoti kya hai. Agar tum ek oscilloscope (ek "voltage camera") ko signal wire aur uske ground par lagao, toh tumhe ek graph dikhega: x-axis par time, y-axis par voltage upar ki taraf.

Upar wali picture poore subject ko ek frame mein dikh ata hai: wire do levels ke beech mein hilti hai, aur har protocol un hilne-dole ko meaning dene ka ek alag tarika hai. Ye graph apne dimaag mein rakho — baad ke har symbol isi par rehta hai.


1. Bit, byte, aur LSB-first


2. Time per bit — "baud" kahan se aata hai

Ab ki ek bit ek time-slot occupy karti hai, humein jaanna hai ki wo slot kitna wide hai.

Greek letter (epsilon) baad mein clock ki "ek chhoti fractional error" ke liye aayega — bas "tiny fraction" ka naam hai, koi darr nahi. Dekho Baud rate & clock generation (timers/PLL) ki chip ye rate apne crystal se actually kaise banati hai.


3. Synchronous vs Asynchronous — clock ka sawaal

Is poore chapter ka sabse gehra fark hai: kya koi alag wire beat carry karti hai?


4. Edge — rising aur falling

Synchronous protocols "kaunsa edge" ki baat karte hain. Bilkul yehi hai edge.


5. Point-to-point vs Bus — wire par kaun hai

Jab kai devices ek wire share karte hain, ek naya khatara aata hai: unme se do ek saath use drive karein. Ye seedha agle idea par le jaata hai.


6. Push-pull vs Open-drain — sharing ki problem


7. Single-ended vs Differential — noise survive karna


8. Symbols jo formulas mein milenge


Prerequisite map

Wire = voltage over time

Bit and byte

Baud and bit time

Clock and edges

Sync vs Async

Push-pull vs Open-drain

Wired-AND logic

I2C sharing and CAN arbitration

Single-ended vs Differential

CAN noise immunity

UART SPI I2C CAN

Vault mein related building blocks: Serial vs Parallel communication, Shift registers, Interrupts vs Polling, Bit stuffing & CRC in CAN frames.


Equipment checklist

Daayeen taraf cover karo; reveal karne se pehle kya tum jawab de sakte ho?

Wire physically kya carry karta hai?
Ek voltage jo HIGH ya LOW ho, time ke saath badlti rahe — aur kuch nahi.
Ek bit kya hota hai?
Ek HIGH-ya-LOW decision; information ki sabse chhoti unit.
0x41 ko decimal aur ek letter mein convert karo.
= letter 'A'.
LSB-first ka matlab kya hai?
worth wali bit (sabse chhoti value) time mein pehle bheji jaati hai.
Bit-time formula aur 9600 baud par do.
.
Synchronous aur asynchronous mein fark?
Synchronous mein shared clock wire hoti hai; asynchronous mein bit time pehle se agree hota hai aur self-timing hoti hai.
Rising edge aur falling edge kya hai?
Rising = LOW→HIGH (↑); falling = HIGH→LOW (↓).
Do push-pull outputs ek bus wire kyun share nahi kar sakte?
Ek HIGH push kare jabki doosra LOW pull kare toh short circuit hota hai.
Open-drain mein kaun sa level hamesha jeetta hai aur kyun?
LOW — ek device sirf low pull ya float kar sakta hai, aur pull-up float=HIGH banata hai, toh koi bhi pull-low dominate karta hai (wired-AND).
Differential pair noise kyun reject karta hai?
Noise dono wires mein barabar add hota hai; receiver difference padha karta hai, toh cancel ho jaata hai: .
CAN par kaun sa bit dominant hai, 0 ya 1?
0 dominant hai (jeetta hai); 1 recessive hai (haarta hai).
Pull-up rise ko se kyun model kiya jaata hai?
Wire ek RC circuit hai jo ki taraf charge hoti hai; full ke paas aake slow hoti hai, classic exponential approach.