| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = Serial Peripheral Interface Bus (SPI) = |
| | 4 | The Serial Peripheral Interface bus is a synchronous serial communication interface specification used for short distance communication primary in embedded systems. The interface was originally developed by Motorola and can be used in a master or slave configuration. It is typically used as a 3-wire bus containing the following signals (other than power and ground and chip-selects): |
| | 5 | * SCLK |
| | 6 | * MISO |
| | 7 | * MOSI |
| | 8 | * SS# (Optional Slave Select) |
| | 9 | |
| | 10 | SPI can be a multi-slave bus if chip selects are used which are asserted by the host controller to enable one device at a time. |
| | 11 | |
| | 12 | References: |
| | 13 | * http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus |
| | 14 | |
| | 15 | |
| | 16 | == USB Expansion devices == |
| | 17 | A SPI master can also be added via USB expansion. For example: |
| | 18 | * [http://trac.gateworks.com/wiki/expansion/gw16113 GW16113 firmware-flexible USB 2.0 FS expansion] |
| | 19 | * [http://www.commell.com.tw/product/Peripheral/PCI%20Express%20mini%20card/MPX-24794S.HTM Commell MPX-24794S USB 2.0 FS SPI/I2C/GPIO expansion] |
| | 20 | |
| | 21 | |
| | 22 | == Ventana == |
| | 23 | |
| | 24 | === GW5220 === |
| | 25 | The i.MX6 Ventana GW5220 brings out the IMX6 ECSPI3 bus to the 6-pin J24 expansion connector for connection to a 3.3V TTL SPI slave device: |
| | 26 | * J24.1 - MOSI |
| | 27 | * J24.2 - MISO |
| | 28 | * J24.3 - SCLK |
| | 29 | * J24.4 - SS0# |
| | 30 | * J24.5 - 3.3V |
| | 31 | * J24.6 - GND |
| | 32 | |
| | 33 | === GW54xx (Revision E+) === |
| | 34 | The i.MX6 Ventana GW54xx brings out the IMX6 ECSPI2 bus to the 6-pin J32 expansion connector for connection to a 3.3V TTL SPI slave device: |
| | 35 | * J32.1 - MOSI |
| | 36 | * J32.2 - MISO |
| | 37 | * J32.3 - SCLK |
| | 38 | * J32.4 - SS0# |
| | 39 | * J32.5 - 3.3V |
| | 40 | * J32.6 - GND |
| | 41 | |
| | 42 | === Adding Kernel Support for Specific SPI Devices === |
| | 43 | In order to support the specific device you plan to connect an addition to the GW5220 device tree must be made. |
| | 44 | |
| | 45 | 1. Follow [http://trac.gateworks.com/wiki/linux/kernel#BuildingtheLinuxkernelout-of-tree these instructions] up to and including step 5 of "Building the Linux Kernel" |
| | 46 | 2. Open the file at {{{.../linux-imx6/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi}}} and find the node labeled "&ecspi3" (if absent, jump to the above section before continuing) |
| | 47 | 3. In the same location as the comment in step 5 of the above section, add your appropriate device configuration in a node beginning with "flash: " |
| | 48 | 4. Continue the instructions from step 1 to finish building your new kernel |
| | 49 | |
| | 50 | An example of a properly made configuration node for a m25p32-vme6g nor flash device would be: |
| | 51 | {{{#!c |
| | 52 | flash: m25p80@0 { /* "m25p80@0" parameter is the driver responsible for controlling your device */ |
| | 53 | compatible = "m25p32"; /* "m25p32" parameter is your device ID string */ |
| | 54 | spi-max-frequency = <30000000>; /* assigned value is your device frequency specified by its datasheet (in decimal) */ |
| | 55 | reg = <0>; /* is generally 0 for single device connections */ |
| | 56 | #device-width = <1>; /* These next three lines are not comments, but rather specially formatted |
| | 57 | #address-cells = <1>; * attributes that the driver will receive. The actual values assigned here |
| | 58 | #size-cells = <1>; * are device specific, and should be entered after consulting the data sheet |
| | 59 | */ |
| | 60 | partition@0 { /* The label of the 0th partition; following partitions follow the "partition@X" format */ |
| | 61 | label = "data"; /* The name of this partition */ |
| | 62 | reg = <0x0 0x2000000>; /* The starting address, followed by the length of the partition (in hex) */ |
| | 63 | }; |
| | 64 | }; |
| | 65 | }}} |
| | 66 | Note that the values shown in the above node are specific to the m25p32-vme6g, and can vary greatly from the actual device you are using. Replace attribute values as necessary. |
| | 67 | |
| | 68 | When searching for your device ID string or its controlling driver, searching via a LXR site like the one at [https://lxr.missinglinkelectronics.com/linux missing link electronics] for your device name can be helpful. |
| | 69 | |
| | 70 | |
| | 71 | == Laguna == |
| | 72 | While SPI is used for on-board FLASH storage for many Laguna boards, it also is brought out to the J9 expansion connector available on the Laguna GW2388: |
| | 73 | * J9.2 - CS# |
| | 74 | * J9.4 - SCLK |
| | 75 | * J9.6 - MISO |
| | 76 | * J9.8 - MOSI |
| | 77 | * J9.10 - GND |
| | 78 | |
| | 79 | [[Image(spi2388.png,800px)]] |