# I2C Exercises uFerris uses an **I/O expander**. An I/O expander is used to expand the number of GPIO pins on a controller. The expander communicates over I2C to configure and control GPIO pins. This means we can get many more GPIO using only two I2C lines! The expander used is the **TCA6424**, and the first exercise would be to find out its address. ## Exercise A: Bus Scan 1. Find a ready I2C example in the [esp-hal I2C documentation](https://docs.rs/esp-hal/latest/esp32c3/esp_hal/i2c/master/struct.I2c.html) 2. Identify the **Instantiate**, **Configure**, and **Control** steps 3. Adapt the pins to match the uFerris board (check your pinout card for SDA and SCL) 4. Scan all addresses (0x01–0x7F) by attempting a write to each — note which devices respond --- ## Exercise B: GPIO over I2C The uFerris board uses a **TCA6424** I/O expander. Its address should have appeared when scanning in Exercise A. 1. Configure the **LED2** pin on the I/O expander as output 2. Blink the LED like GPIO Exercise A Refer to the **workshop book** for detail on how to access the individual pins, what needs to be written and read where. --- ## Exercise C: Adaptation Challenge 1. Configure the **Button 1** pin on the I/O expander as **input** 2. Replicate the GPIO exercise, but entirely over I2C --- ## Cross-HAL Comparison How do other HALs handle I2C? Navigate the documentation for these two libraries and find how they approach the same tasks: - [rp2040-hal](https://docs.rs/rp2040-hal/latest/rp2040_hal/) - [stm32f4xx-hal](https://docs.rs/stm32f4xx-hal/latest/stm32f4xx_hal/) Compare how each HAL handles **Instantiate**, **Configure**, and **Control** for I2C.
The Embedded Rustacean · Rust Week 2026