The goal of this project is to demonstrate the use of the I2C bus using various microcontrollers. Often the provided documentations are too short and the examples too stupid to be of any use.
We need a master talking to a slave using the I2C bus, with the following constraints:
- Being able to send and read multiple bytes with one transfer.
- Neither the master nor the slave should crash or be stuck into a loop because there was an error on the bus. You should be able to power off any of the two systems and get it working when you power it back. Ideally, you should be able to detect a transfer error.
- You should get the right packets at the right time (and not get an old packet which was stuck into a buffer).
TI's Stellaris Launchpad (EK-LM4F120XL, with LM4F120H5QR), using its DriverLib.
This example has a master sending a byte to a slave, and their reading one byte from it.
A version using interrupts and a version not using them are provided.
This example has a master sending two integers and a char to a slave. The slave compute a simple math operation on the two integers. Then the master reads the result.
A version using interrupts is provided.
Author: Erwan Martin <public@fzwte.net>
ARENIB Delta
License: MIT unless noted otherwise