Book Image

Beaglebone Essentials

By : Rodolfo Giometti
Book Image

Beaglebone Essentials

By: Rodolfo Giometti

Overview of this book

Table of Contents (18 chapters)
BeagleBone Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Accessing the bus directly


Now, as for a 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, if one of them doesn't have a dedicated driver, they can be managed directly from the user space. The only problem that may arise is if the I2C device generates 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.

For example, we're going to manage the DAC chip named TC1321. If we take a look at the chip's datasheet, we can see that its functioning is very simple: it has one 16-bit register at offset 0x00, where we can write the digital data to be converted.

Tip

The datasheet is available at the URL http://ww1.microchip.com/downloads/en/DeviceDoc/21387C.pdf.

The register has the following format:

Data register = first byte

Data register = second byte

D9

D8

D7

D6

D5

D4

D3

D2

D1

D0

-

...