Page 319 - ARM Based Microcontroller Projects Using MBED
P. 319

CHAPTER
                                                11






                                     2
                                   I C Bus Projects











                                           11.1 OVERVIEW

                                                                  2
              In this chapter we shall be developing projects using the I C (interintegrated circuit) bus
            with the Nucleo-F411RE development board.
                   2
              The I C bus was invented by Philips Semiconductor in 1982 for connecting peripheral
            devices and microcontrollers over short distances. The bus uses two open collector (or open
            drain) bidirectional lines pulled up with resistors. The SDA is the serial data line and SCL is
            the serial clock line. Although the bus is bidirectional, data can travel only in one direction
                        2
            at any time. I C is a bus with 7-bit address space and achieves bus speeds of 100kbits/s in
            standard mode and 400kbits/s in fast mode (faster bus speeds are also available with Version
            2.0 of the bus protocol). Devices on the bus can be one or more master nodes and one or
            more slave nodes. The master nodes initiate the communication and generate the clock
            signals on the bus. Slave nodes receive the clock signals and respond when addressed
            by a master.
                                        2
              Fig. 11.1 shows an example I C system with one master and three slaves. In a typical ap-
            plication the master initiates the communication on the bus by signaling a start condition.
            This is followed by 7 bits of address information (10-bit addressing mode is also available),
            and one data direction bit, where a LOW means that the master is writing to the slave, and a
            HIGH means that the master is reading from the slave. With 7 bits of address up to 128 devices
            can be connected to the bus. When reading and writing to the bus we have to specify the de-
            vice address, register address, and the number of bytes.
                                                                        2
              Mbed supports a number of functions for both master and slave I C bus communication.
                   2
            In the I C projects in this book the Nucleo-F411RE development board will be the
            master and one or more slaves will be connected to the bus. Since we will be programming
            the master only, a list of the functions available for the master nodes is presented in
                                         2
            Table 11.1.WhencreatinganI C variable we have to specify the GPIO pins for SDA
            and SCL.





                                                   305
            ARM-based Microcontroller Projects Using mbed                # 2019 Elsevier Ltd. All rights reserved.
            https://doi.org/10.1016/B978-0-08-102969-5.00011-2
   314   315   316   317   318   319   320   321   322   323   324