The Raw I2C Bus
Now, as done for USB bus we should take a look at how we can get direct access to the I2C bus. In the same manner as for USB devices when one of them hasn't a dedicated driver it can be managed directly from the user space. The only problem may arise if the I2C device can generate interrupts, in this case we cannot manage these signals from the user-space and a kernel driver must be used. However this is a rare case and the presented technique can be used in most cases.
Writing data in C
As first example we're going to write some data to the DAC chip named TC1321 which is mounted on the development board we used above connected to the BeagleBone Black board.
Note
The datasheet is available at the URL: http://ww1.microchip.com/downloads/en/DeviceDoc/21387C.pdf
By looking at the chip's datasheet we see that its functioning is very simple: it has one 16-bit register at offset 0x00
where we can write digital data to be converted. In fact the register has the format reported below...