Перейти к содержимому

UART vs SPI vs I2C: I Broke All 3 on Purpose

ARAMA explains

0:00 / 0:00

UART vs SPI vs I2C: I Broke All 3 on Purpose

463 просмотра · 9 дн. назад
ARAMA explains
22 подписчика
463 просмотра · 9 дн. назад
YouTube Title *UART vs SPI vs I2C: Why Your Sensor Returns Garbage, Wrong Values, or Nothing* YouTube Description Your code is correct. Your wiring looks correct. But the terminal still shows garbage, the SPI sensor returns the wrong value, or the I2C scanner finds absolutely nothing. The problem may not be your code—it may be the conversation between the chips. In this video, we break down *UART, SPI, and I2C* by deliberately causing common communication failures and examining exactly why they happen. You’ll learn: How UART sends data using baud rate, start bits, data bits, and stop bits Why mismatched baud rates create corrupted or meaningless characters How SPI uses clock, MOSI, MISO, and chip select Why SPI mode 0, 1, 2, and 3 matter Why reading from an SPI sensor often requires sending a dummy byte How I2C uses only two wires to connect multiple devices Why I2C needs pull-up resistors How resistor values affect I2C rise time The difference between a 7-bit and 8-bit I2C address Why using `0x90` instead of `0x48` can make a working sensor appear dead How to diagnose garbage, wrong values, and silence in seconds Quick Troubleshooting Guide *Garbage output:* Check the UART baud rate, TX/RX wiring, common ground, and voltage levels. *Wrong SPI values:* Check the SPI mode, chip-select timing, clock edges, and dummy bytes. *No I2C device detected:* Check the pull-up resistors and confirm whether the sensor address is 7-bit or 8-bit. We also walk through a complete I2C temperature reading and convert the raw hexadecimal data into an actual temperature value. The code was never the problem. The conversation was. In the next video, we’ll connect two I2C sensors with the same address—and show you the trick that allows both devices to work on the same bus. Which problem has caused you the most trouble: *garbage, wrong values, or silence?* Let us know in the comments. If this video helped you understand serial communication, please *like the video, subscribe to the channel, and share it with another engineer or electronics enthusiast.* Chapters 00:00 The Three Communication Problems 00:35 Parallel vs Serial Communication 01:25 How UART Works 02:40 Breaking UART with the Wrong Baud Rate 03:25 How SPI Works 04:45 SPI Modes and Timing Errors 05:40 Breaking SPI with the Wrong Mode 06:20 How I2C Works 07:30 Pull-Up Resistors and Rise Time 08:45 The 7-Bit vs 8-Bit Addressing Mistake 10:00 Reading a Temperature Sensor Over I2C 10:45 UART vs SPI vs I2C Troubleshooting Guide 11:20 Which Protocol Should You Choose? 11:50 Final Summary and Next Video Hashtags #UART #SPI #I2C #EmbeddedSystems #Electronics #Microcontrollers #Arduino #ESP32 #STM32 #Sensors #SerialCommunication #EmbeddedEngineering #ElectricalEngineering #Programming #HardwareDebugging