Intel Edison Tutorial 5 - SPI, PWM, and GPIO Interfaces - IoT Platform Intel Edison Tutorial 5 SPI PWM and More GPIO Intel Edison Tutorial 5 SPI PWM and

Intel Edison Tutorial 5 - SPI, PWM, and GPIO Interfaces -...

This preview shows page 1 - 6 out of 21 pages.

Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO 1 IoT Platform Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO
Image of page 1
Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO 2 Table of Contents Introduction ..................................................................................................................... 3 Things Needed ................................................................................................................ 3 SPI .................................................................................................................................... 4 PWM ............................................................................................................................... 11 GPIO Revisited ............................................................................................................. 16 Shield Pin Configuration .............................................................................................. 19 References .................................................................................................................... 21 Revision history Version Date Comment 1.0 1/11/2015 Initial release
Image of page 2
Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO 3 Introduction Tutorial 4 introduced the basics of I/O interfaces on Intel Edison. This tutorial will guide you through even more interfaces and what is beneath the abstractions of I/O programming. In this tutorial, you will learn to: 1. Establish an SPI communication between the Intel Edison and the Arduino Uno, 2. Control a servo using the Intel Edison’s PWM, 3. Access the GPIO without MRAA, and 4. Configure the shield pins. Things Needed 1. An Intel Edison with Arduino-compatible breakout, 2. An Arduino Uno, 3. A Grove Starter kit, 4. A micro USB cable, 5. Wires, 6. An external power supply or a powered USB hub, and 7. A PC or Mac
Image of page 3
Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO 4 SPI The Serial Peripheral Interface (SPI) bus is a synchronous serial communication between one master device and one or more slave devices for a short distance. Along with I2C, SPI is primarily used in embedded systems. The motivation of the development of these buses is reducing the number of wires. A common way to connect peripherals to a CPU/microcontroller is connecting through parallel address and data busses. This way, a bus can result in a lot of wires on PCB (printed circuit board). A bus with many wires is not desirable for embedded systems. In comparison to parallel buses, SPI operates with only four wires. A figure below illustrates a single master to a single slave SPI bus. Figure 1 SPI Between a Single Master and a Single Slave SCLK (serial clock) is the clock line. The master device sends the clock signal to its slave devices through SCLK, which synchronizes the data communication. MOSI (master out, slave in) and MISO (master in, slave out) are the data lines. The reason why there are two data lines in SPI is to have full duplex communication (i.e. simultaneous communication in both directions). Every clock cycle, the master device sends a bit to the slave via MOSI and the slave device sends a bit to the master via MISO. SS (slave select) is the line, which the master device use to select the slave device for data transmission/request by pulling down (i.e. making the signal to logic level 0). There are four different transmission modes, which depend on the master devices configuration of the clock phase (CPHA) and the clock polarity (CPOL). The details of the modes, clock phase, and clock polarity are out of the scope of this tutorial. However, you are encouraged to learn about them.
Image of page 4
Intel ® Edison Tutorial 5: SPI, PWM, and More GPIO 5 In this tutorial, we will implement SPI in mode 0 (CPHA = 0 and CPOL = 0) between an Intel Edison and an Arduino Uno. First, we need to configure the wire connection between these devices as shown in Figure 1. The Edison’s Arduino-compatible breakout and the Arduino Uno
Image of page 5
Image of page 6

You've reached the end of your free preview.

Want to read all 21 pages?

  • Winter '15
  • WilliamKaiser
  • Serial Peripheral Interface Bus, ........., SPI

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture