You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Communication_Protocols/I2C_Protocol.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,11 @@ I2C (Inter-Integrated Circuit) is a synchronous, multi-master, multi-slave, pack
32
32
-**Clock stretching** - Slaves can slow down communication
33
33
-**Arbitration** - Non-destructive arbitration for bus access
34
34
35
+
### **Interviewer intent (what they’re probing)**
36
+
- Can you explain open‑drain + pull‑ups and rise‑time limits?
37
+
- Do you understand arbitration and clock stretching behavior?
38
+
- Can you reason about bus speed vs capacitance?
39
+
35
40
## 🤔 **What is I2C Protocol?**
36
41
37
42
I2C protocol is a synchronous serial communication standard that enables multiple devices to communicate over a shared two-wire bus. It uses a master-slave architecture with support for multiple masters, making it ideal for connecting multiple integrated circuits, sensors, and peripheral devices in embedded systems.
- Can you explain CPOL/CPHA and timing setup/hold?
37
+
- Do you know how chip‑select timing affects multi‑slave buses?
38
+
- Can you reason about throughput vs CPU/DMA trade‑offs?
39
+
35
40
## 🤔 **What is SPI Protocol?**
36
41
37
42
SPI protocol is a synchronous serial communication standard that enables high-speed data exchange between a master device (typically a microcontroller) and one or more slave devices (peripherals such as sensors, memory chips, displays, etc.). It uses a shared clock signal to synchronize data transmission, ensuring reliable and efficient communication.
Copy file name to clipboardExpand all lines: Embedded_C/C_Language_Fundamentals.md
+21-19Lines changed: 21 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,22 +144,22 @@ C is primarily a **procedural programming language**, which means:
144
144
145
145
### **Memory Model**
146
146
147
-
C uses a **static memory model** with manual memory management:
147
+
C defines an abstract machine; the actual memory layout is implementation-defined. Embedded targets typically place code in Flash/ROM and data in RAM, and the linker script controls section placement.
148
148
149
149
```
150
-
C Memory Layout:
150
+
Typical Embedded Memory Layout (varies by target/toolchain):
double double_precision; //Implementation-defined (32 or 64-bit)
311
311
```
312
312
313
313
#### **Character Types**
@@ -623,9 +623,9 @@ Memory management in C involves allocating, using, and freeing memory resources.
623
623
624
624
**Memory Types:**
625
625
-**Stack Memory**: Automatic allocation for local variables
626
-
-**Heap Memory**: Dynamic allocation with malloc/free
627
-
-**Static Memory**: Global and static variables
628
-
-**Constant Memory**: Read-only data and code
626
+
-**Heap Memory**: Dynamic allocation with malloc/free (if enabled)
627
+
-**Static Storage**: Global and static variables
628
+
-**Flash/ROM**: Read-only code and const data (platform concept)
629
629
630
630
**Memory Lifecycle:**
631
631
-**Allocation**: Requesting memory from the system
@@ -765,7 +765,7 @@ An array name in an expression decays to a pointer to its first element. The arr
765
765
766
766
### Why it matters in embedded
767
767
- Knowing when decay happens prevents bugs with `sizeof` and parameter passing.
768
-
- Arrays placed in Flash as `static const` look like ordinary arrays but are read‑only and may require `volatile`when mapped to hardware.
768
+
- Arrays placed in Flash as `static const` look like ordinary arrays but are read‑only; use `volatile`only for memory‑mapped registers or data changed by hardware/ISRs.
769
769
770
770
### Minimal example: decay and sizeof
771
771
```c
@@ -959,6 +959,7 @@ typedef union {
959
959
uint8_t raw[34];
960
960
} protocol_message_t;
961
961
```
962
+
> Note: Type-punning through unions is implementation-defined in C. For strict portability, use `memcpy` to move between object representations.
0 commit comments