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

The 1-Wire bus in Linux


On our BeagleBone Black, there are no 1-Wire controllers, so we have to find a way to implement one in order to be able to talk to a 1-Wire device. Several solutions exist but considering the low data transfer of this bus, the best and cheapest option is to use a software solution.

In Linux, several buses can be emulated by the software and the 1-Wire bus (along with the I2C and SPI buses) is one of them. In order to do so, we need to locate the driver, in Linux's sources, in the drivers/w1/masters/w1-gpio.c file, and we simply need to choose a GPIO, which is to be selected as the data bus, and the trick is done.

The DTS file used to set up the BeagleBone Black and the w1-gpio driver can be written in the chapter_10/BB-W1-GPIO-00A0.dts file in the book's example code repository. In this file, the pin P8.11 is used as a data signal, and in fragment@0, there is the related GPIO setup:

    /* Define the pins usage */
    exclusive-use =
            /* the pin header P8...