In this lesson, you will learn how to leverage internal address auto-incrementing to stream large blocks of data across a serial bus without the overhead of re-addressing for every single byte.
The Bottleneck of Sequential Access
In standard communication protocols like I2C or SPI, a typical read or write transaction requires you to send a specific device address followed by a register memory address. If you want to read 100 bytes of sensor data, performing this handshake 100 times is incredibly inefficient. You waste bus cycles sending the same address headers repeatedly, which limits your throughput and increases latency.
The Auto-Increment Mechanism
Many complex peripherals (such as EEPROMs, display controllers, and high-speed sensors) implement a hardware feature called Auto-Increment. When this feature is active, the peripheral’s internal address pointer automatically increments to the next memory location after each successful byte transfer.
By sending a single "Start Address" at the beginning of the transaction, you essentially "unlock" a stream of data. The peripheral holds the connection open, and as long as your Master continues to provide clock pulses (in SPI) or acknowledge bits (in I2C), the device will keep pumping out data from the next sequential address.
Conceptual Implementation
Instead of looping through an address pointer in your software, you set the pointer once and loop only over the data buffer:
// Sending a burst of 16 bytes to a device
void WriteBurst(uint8_t start_reg, uint8_t *data, uint8_t length) {
I2C_Start();
I2C_SendAddress(DEVICE_ADDR, WRITE);
I2C_WriteByte(start_reg); // Set the starting point
// The device hardware now auto-increments the register pointer
// for every byte written in the loop below.
for (int i = 0; i < length; i++) {
I2C_WriteByte(data[i]);
}
I2C_Stop();
}
By removing the repeated addressing overhead, you maximize your bandwidth and ensure the bus is occupied by actual payload data rather than management signaling. Always ensure your peripheral supports this, as some basic devices require manual register selection for every single byte.
Key Takeaway: Auto-incrementing allows you to transmit entire data blocks by setting a single starting address, drastically reducing bus overhead and increasing communication throughput.