Interfacing FXLS8471Q with i.MX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interfacing FXLS8471Q with i.MX6Q

Interfacing FXLS8471Q with i.MX6Q

 

Introduction

 

This document describes how to interface and use Xtrinsic FXLS8471Q digital accelerometer with IMX6Q processor. For this purpose, UDOO Quad board is used with NXP Linux image for IMX6QSABRE-SD board with Kernel 3.14.56 (not with Udoobuntu) to simulate working with a custom board, the process to customize and build such image for UDOO Quad board is described here: Building Linux Image with QT5 for UDOO Quad 

 

On the sensor side FRDM-FXS-MULTI(-B) sensor expansion board which features many of the Xtrinsic sensors introduced in 2013 including the FXSL8471Q is used.

 

Hardware Connections

 

 The SPI signals from FRDM-FXS-MULTI are routed to SPI1 module of UDOO Quad. FXLS8471Q provides an INT pin which is indicated on image below, however on this implementation polling method is used. Please note that Chip Select is not controlled automatically by SPI module, therefore this pin is configured as GPIO. Besides these signals, reset and power source pins were also connected.

 

The following figure shows the pins used in FRDM-FXS-MULTI which are connected with UDOO Quad board.

 

193531_193531.pngpastedImage_11.png

 

 

 

 

The pins used on the UDOO Quad side are shown in the images below. You can find UDOO Quad pinout diagram here Index of /download/files/pinout.  

 

 

 

193533_193533.png2017-09-05_18-02-20.png

 

 

 

 

 

 

193532_193532.pngpastedImage_15.png

 

 

 

 

Device Tree Configuration

 

As mentioned at the beginning of this document, a NXP Linux image for IMX6Q-SABRESD is used. In order to customize this image to be used with the UDOO Quad board it is necessary to build a .dtb that matches with it. This task was accomplished obtaining dts and dtsi source files listed below from Kernel Linux Repository for UDOO at UDOOboard (UDOOboard) · GitHub.

 

  • imx6qdl-udoo.dtsi
  • imx6qdl-udoo-externalpins.dtsi
  • imx6q-udoo-hdmi.dts

 

These files were copied into the IMX6Q-SABRESD build source folder and a imx6q-udoo.dtb was generated. This process is described on Building Linux Image with QT5 for UDOO Quad 

 

The following snippets show how the nodes involved on the SPI configuration were set for UDOO Quad board. Please note that each device tree should match your custom board.

 

In imx6qdl-udoo-externalpins.dtsi verify that ecspi1 node matches with the one shown below.

 

&ecspi1 {
    fsl,spi-num-chipselects = <1>;
    cs-gpios = <&gpio5 17 0>;
    pinctrl-0 = <&pinctrl_ecspi1>;
    pinctrl-names = "default";
    status = "disabled";

    spidev0: spi@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <2000000>;
    };
};

 

 

As you can see on snippet above, ecspi1 node uses pinctrl_ecspi1 as the pin configuration node which is defined in the same file and it looks as follows.

 

       pinctrl_ecspi1: ecspi1grp {
            fsl,pins = <
            MX6QDL_PAD_DISP0_DAT22__ECSPI1_MISO  0x100b1
            MX6QDL_PAD_DISP0_DAT20__ECSPI1_SCLK  0x100b1
            MX6QDL_PAD_DISP0_DAT21__ECSPI1_MOSI  0x100b1
            MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17   0x80000000
            >;
        };

 

However, as you may know each pin on i.MX devices has up to 8 potential functions, and on the other side, one function can be available in different pins.

 

For example, ECSPI1_MISO can be mapped to 4 different pins

 

193535_193535.pngpastedImage_31.png

 

and each pin can have different functions. From all the available functions in a pin one is chosen to be the pad (pin) name. In the image below DISP0_DATA22 was chosen to be the pad name.

 

194454_194454.pngpastedImage_2.png

 

 

Now, back to pinctrl_ecspi1 node, the macros used here are defined in imx6q-pinfuc.h, as you can see DISP0_DAT20 - DISP0_DAT23 are the pads used with the ECSPI signals.

 

It is necessary to check it that there are no other configurations for DISP0_DAT20 - DISP0_DAT23 and if they are it is necessary to comment out them or delete them. In this case there were other configurations for these pins in imx6qdl-udoo-externalpins.dtsi and they were commented out.

 

 

&iomuxc {
    imx6q-udoo {
        // External Pinout GPIOs
        external_hog: hoggrp-2 {
        fsl,pins = <
            MX6QDL_PAD_CSI0_DAT11__GPIO5_IO29    0x80000000  // {{external-gpio-0}}
            MX6QDL_PAD_CSI0_DAT10__GPIO5_IO28    0x80000000  // {{external-gpio-1}}
            MX6QDL_PAD_SD1_CLK__GPIO1_IO20       0x80000000  // {{external-gpio-2}}
            MX6QDL_PAD_SD1_DAT0__GPIO1_IO16      0x80000000  // {{external-gpio-3}}
            MX6QDL_PAD_SD1_DAT1__GPIO1_IO17      0x80000000  // {{external-gpio-4}}
            MX6QDL_PAD_SD1_CMD__GPIO1_IO18       0x80000000  // {{external-gpio-5}}
            MX6QDL_PAD_SD4_DAT1__GPIO2_IO09      0x80000000  // {{external-gpio-6}}
            MX6QDL_PAD_SD4_DAT2__GPIO2_IO10      0x80000000  // {{external-gpio-7}}
            MX6QDL_PAD_SD1_DAT3__GPIO1_IO21      0x80000000  // {{external-gpio-8}}
            MX6QDL_PAD_SD1_DAT2__GPIO1_IO19      0x80000000  // {{external-gpio-9}}
            MX6QDL_PAD_GPIO_1__GPIO1_IO01        0x80000000  // {{external-gpio-10}}
            MX6QDL_PAD_GPIO_9__GPIO1_IO09        0x80000000  // {{external-gpio-11}}
            MX6QDL_PAD_GPIO_3__GPIO1_IO03        0x80000000  // {{external-gpio-12}}
            MX6QDL_PAD_SD4_DAT0__GPIO2_IO08      0x80000000  // {{external-gpio-13}}
            MX6QDL_PAD_CSI0_DAT4__GPIO5_IO22     0x80000000  // {{external-gpio-14}}
            MX6QDL_PAD_CSI0_DAT16__GPIO6_IO02    0x80000000  // {{external-gpio-15}}
            MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00    0x80000000  // {{external-gpio-16}}
            MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01    0x80000000  // {{external-gpio-17}}
            MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30    0x80000000  // {{external-gpio-18}}
            MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31    0x80000000  // {{external-gpio-19}}
            MX6QDL_PAD_EIM_D28__GPIO3_IO28       0x80000000  // {{external-gpio-20}}
            MX6QDL_PAD_EIM_D21__GPIO3_IO21       0x80000000  // {{external-gpio-21}}
            MX6QDL_PAD_DISP0_DAT6__GPIO4_IO27    0x80000000  // {{external-gpio-22}}
            MX6QDL_PAD_DISP0_DAT7__GPIO4_IO28    0x80000000  // {{external-gpio-23}}
            MX6QDL_PAD_DISP0_DAT8__GPIO4_IO29    0x80000000  // {{external-gpio-24}}
            MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30    0x80000000  // {{external-gpio-25}}
            MX6QDL_PAD_DISP0_DAT10__GPIO4_IO31   0x80000000  // {{external-gpio-26}}
            MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05   0x80000000  // {{external-gpio-27}}
            MX6QDL_PAD_DISP0_DAT12__GPIO5_IO06   0x80000000  // {{external-gpio-28}}
            MX6QDL_PAD_DISP0_DAT13__GPIO5_IO07   0x80000000  // {{external-gpio-29}}
            MX6QDL_PAD_DISP0_DAT14__GPIO5_IO08   0x80000000  // {{external-gpio-30}}
            MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09   0x80000000  // {{external-gpio-31}}
            MX6QDL_PAD_DISP0_DAT16__GPIO5_IO10   0x80000000  // {{external-gpio-32}}
            MX6QDL_PAD_DISP0_DAT17__GPIO5_IO11   0x80000000  // {{external-gpio-33}}
            MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12   0x80000000  // {{external-gpio-34}}
            MX6QDL_PAD_DISP0_DAT19__GPIO5_IO13   0x80000000  // {{external-gpio-35}}
            //MX6QDL_PAD_DISP0_DAT20__GPIO5_IO14   0x80000000  // {{external-gpio-36}}
            //MX6QDL_PAD_DISP0_DAT21__GPIO5_IO15   0x80000000  // {{external-gpio-37}}
            MX6QDL_PAD_EIM_A16__GPIO2_IO22       0x80000000  // {{external-gpio-38}}
            MX6QDL_PAD_GPIO_18__GPIO7_IO13       0x80000000  // {{external-gpio-39}} (KEY_VOL_UP)
            MX6QDL_PAD_NANDF_D0__GPIO2_IO00      0x80000000  // {{external-gpio-40}} (HOME)
            MX6QDL_PAD_NANDF_D3__GPIO2_IO03      0x80000000  // {{external-gpio-41}} (SEARCH)
            MX6QDL_PAD_NANDF_D2__GPIO2_IO02      0x80000000  // {{external-gpio-42}} (BACK)
            MX6QDL_PAD_NANDF_D1__GPIO2_IO01      0x80000000  // {{external-gpio-43}} (MENU)
            MX6QDL_PAD_GPIO_19__GPIO4_IO05       0x80000000  // {{external-gpio-44}} (KEY_VOL_DOWN)
           // MX6QDL_PAD_DISP0_DAT22__GPIO5_IO16   0x80000000  // {{external-gpio-45}}
            //MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17   0x80000000  // {{external-gpio-46}}
            MX6QDL_PAD_EIM_D25__GPIO3_IO25       0x80000000  // {{external-gpio-47}}
            MX6QDL_PAD_KEY_ROW1__GPIO4_IO09      0x80000000  // {{external-gpio-48}}
            MX6QDL_PAD_KEY_COL1__GPIO4_IO08      0x80000000  // {{external-gpio-49}}
            MX6QDL_PAD_EIM_OE__GPIO2_IO25        0x80000000  // {{external-gpio-50}}
            MX6QDL_PAD_EIM_CS1__GPIO2_IO24       0x80000000  // {{external-gpio-51}}
            MX6QDL_PAD_EIM_CS0__GPIO2_IO23       0x80000000  // {{external-gpio-52}}
            MX6QDL_PAD_EIM_D24__GPIO3_IO24       0x80000000  // {{external-gpio-53}}
            MX6QDL_PAD_GPIO_8__GPIO1_IO08        0x80000000  // {{external-gpio-54}}
            MX6QDL_PAD_GPIO_7__GPIO1_IO07        0x80000000  // {{external-gpio-55}}
            >;
        };

 

 

Finally, in imx6q-udoo-hdmi.dts enable ECSPI by including an ecspi1 node reference and setting the status property to "okay".

 

dts-v1/;
#include "imx6q.dtsi"
#include "imx6qdl-udoo.dtsi"
#include "imx6qdl-udoo-externalpins.dtsi"

/ {
    model = "UDOO Quad Board";
    compatible = "udoo,imx6q-udoo", "fsl,imx6q";        mxcfb1: fb@0 {
        compatible = "fsl,mxc_sdc_fb";
        disp_dev = "hdmi";
        interface_pix_fmt = "RGB24";
        mode_str ="1920x1080M@60";
        default_bpp = <32>;
        int_clk = <0>;
        late_init = <0>;
        status = "okay";
    };
};


&ecspi1 {
    status = "okay";
};

 

Note: This could be done in .dtsi but the side effect is that any configuration including the dtsi will have ECSPI1 enabled by default.

 

Finally it is necessary to rebuild the device tree and copy it to the FAT partition of the sdcard. This process is explained in next section.

 

Rebuilding Image

 

Requirements

In order to build an image as well as an application it is necessary to install a tool to cross-compile code, this way we will be able to generate executable files for ARM architecture in our host machine. This tool is called meta-toolchain, the following commands are used to install it.

 

In the following instructions it is considered that the build directory is ~/fsl-release_bsp/build_imx6qsabresd_qt5/

 

$ cd ~/fsl-release_bsp

$ source setup-environment build_imx6qsabresd_qt5

$ bitbake meta-toolchain
$ sh tmp/deploy/sdk/fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-<kernel>.sh

Kernel

 

In order to enable the kernel SPI driver it is necessary to set it in the menuconfig and rebuild zImage.

 

Go to kernel directory within the Yocto build directory that we created.

$ cd <build_directory>/tmp/work-shared/imx6qsabresd/kernel-source$

 

Launch menuconfig for imx

$ source /opt/fsl-imx-x11/<kernel version>/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi

$ make imx_v7_defconfig

$ make menuconfig

 

Enable SPI Driver by going to Device Drivers --> SPI Support and seting '*' to SPI device Driver, save changes and then exit.

 

194542_194542.pngmenuconfig_spi.png

 

And build zImage

$ make zImage

 

The generated file is located in <build_directory>/tmp/work-shared/imx6qsabresd/kernel-source/arch/arm/boot$ and it must be copied to the FAT partition of the SD card.

 

Device Tree

 

To build the device tree go to kernel directory within the Yocto build directory that we created.

$ cd <build_directory>/tmp/work-shared/imx6qsabresd/kernel-source$

 

Build dtb file

$ source /opt/fsl-imx-x11/<kernel version>/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi

$ make imx_v7_defconfig

$ make imx6q-udoo-hdmi.dtb

 

The generated file is located in <build_directory>/tmp/work-shared/imx6qsabresd/kernel-source/arch/arm/boot/dts$ and it must be renamed as imx6q-udoo.dtb and copied to the FAT partition of the SD card.

 

Application Driver

 

The SPI kernel driver uses a structure named spi_ioc_transfer which describes a single SPI transfer. It holds pointers to userspace buffers with transmit and receive data, length of buffers, speed, bits per word among other configurations. For further details you can refer to /include/uapi/linux/spi/spidev.h on your kernel source. In the next section the application driver is explained.

 

The source files of the application driver as well as the device tree sources can be found in the attached.zip file.

 

Main

 

The following code shows function main where the SPI driver is initialized driver using "/dev/spidev0.0" which is listed under /dev (in the target root file system) after SPIdev driver is enabled in menuconfig and kernel is rebuilt as indicated in previous section. Then it reads who am i register just for sanity check purpose and initializes and calibrates the sensor and enters in an endless loop where it reads the sensor whenever there is new data ready. Raw data is returned in 6 bytes, so it is managed to get X, Y and Z values and finally these values are converted to G's values and it waits until a key is pressed to continue to read the following value.

 

 

/****************************************************************************** * Main ******************************************************************************/
int main(){
     //enableGPIO(); //In case of using interrupt instead of polling
     file = spi_init("/dev/spidev0.0"); //dev
     who();
     FXLS8471Q_Init();
     FXLS8471Q_Calibration();


     while(1)
     {
         checkData();

         if (DataReady) // Is a new set of data ready?
         {
             buffer = (unsigned char *)spi_read(OUT_X_MSB_REG, 6, file); // Read data output registers 0x01-0x06
             printf("AccData[0] = 0x%X \n AccData[1] = 0x%X \n AccData[2] = 0x%X \n AccData[3] = 0x%X \n AccData[4] = 0x%X \n AccData[5] = 0x%X \n", AccData[0], AccData[1], AccData[2], AccData[3], AccData[4], AccData[5]);

             Xout_14_bit = ((short) (AccData[0] << 8 | AccData[1])) >> 2; // Compute 14-bit X-axis output value
             Yout_14_bit = ((short) (AccData[2] << 8 | AccData[3])) >> 2; // Compute 14-bit Y-axis output value
             Zout_14_bit = ((short) (AccData[4] << 8 | AccData[5])) >> 2; // Compute 14-bit Z-axis output value

             Xout_g = ((float) Xout_14_bit) / SENSITIVITY_2G; // Compute X-axis output value in g's
             Yout_g = ((float) Yout_14_bit) / SENSITIVITY_2G; // Compute Y-axis output value in g's
             Zout_g = ((float) Zout_14_bit) / SENSITIVITY_2G; // Compute Z-axis output value in g's

             //printf(" X = %d Y = %d Z = %d \n\n", AccData[0], AccData[2], AccData[4]);
             //printf("Xval = %d Yval = %d Zval = %d \n", Xout_14_bit, Yout_14_bit, Zout_14_bit);
             printf(" XG = %f YG = %f ZG = %f \n\n", Xout_g, Yout_g, Zout_g);
             getchar(); 
        }
     }

     close(file);
}

Init Driver

 

The spi_init function opens a file for the driver "/dev/spidev0.0" which is passed as a parameter from main(), then the SPI configuration parameters are read just for informative purpose. Finally struct xfer which is of type spi_ioc_transfer is initialized.

 

/********************************* SPIdev Init **********************************************/
int spi_init(char filename[40])
{
 int file;
 unsigned char mode, lsb, bits;
 unsigned int baudrate = 524250, speed;

 printf("SPI Init \n");
 if ((file = open(filename,O_RDWR)) < 0)
 {
 printf("Failed to open the bus.");
 /* ERROR HANDLING; you can check errno to see what went wrong */
 com_serial=0;
 exit(1);
 }

 if (ioctl(file, SPI_IOC_RD_MODE, &mode) < 0)
 {
 perror("SPI rd_mode");
 return -1;
 }
 
 if (ioctl(file, SPI_IOC_RD_LSB_FIRST, &lsb) < 0)
 {
 perror("SPI rd_lsb_fist");
 return -1;
 }
 
 if (ioctl(file, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0)
 {
 perror("SPI bits_per_word");
 return -1;
 }
 
 if (ioctl(file, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0)
 {
 perror("SPI max_speed_hz");
 return -1;
 }
 printf("%s: spi mode %d, %d bits %s per word, %d Hz max\n",filename, mode, bits, lsb ? "LSB first" : "MSB first", baudrate);

 xfer[0].len = 3; /* Length of command to write*/
 xfer[0].cs_change = 0; /* Keep CS activated */
 xfer[0].delay_usecs = 0; //delay in us
 xfer[0].speed_hz = 524250; //speed
 xfer[0].bits_per_word = 8; // bites per word 8

 xfer[1].len = 4; /* Length of Data to read */
 xfer[1].cs_change = 0; /* Keep CS activated */
 xfer[1].delay_usecs = 0;
 xfer[1].speed_hz = 524250;
 xfer[1].bits_per_word = 8;

 printf("SPI Init Finished \n");
 return file;
}

 

 

Write

 

The SPI communication is started with the  falling edge on chip select pin. A write operation is initiated by transmitting a 1 for the R/W bit. Then the 8-bit register address, ADDR[7:0] is encoded in the first and second serialized bytes. Data to be written starts in the third serialized byte. The order of the bits is as follows:

 

Byte 0: R/W, ADDR[6], ADDR[5], ADDR[4], ADDR[3], ADDR[2], ADDR[1], ADDR[0]

Byte 1: ADDR[7], X, X, X, X, X, X, X

Byte 2: DATA[7], DATA[6], DATA[5], DATA[4], DATA[3], DATA[2], DATA[1], DATA[0]

 

The SPI communication is finished with the  falling edge on chip select pin.

 

A you can see below array buf keeps the destination address and the data to be transferred, then xfer structure is configured to point to buf as the transfer buffer and the length of the data es set to 2 + data size (the first 2 bytes are for the destination address which is splitted in 2 bytes). Finally the transfer is started by the ioctl command.

 

/******************** Write a byte to the FXLS8471Q ***************************
* Byte 0: 1,ADDR[6],ADDR[5],ADDR[4],ADDR[3],ADDR[2],ADDR[1],ADDR[0] 
* Byte 1: ADDR[7],0,0,0,0,0,0,0 
* Byte 2: DATA[7],DATA[6],DATA[5],DATA[4],DATA[3],DATA[2],DATA[1],DATA[0] 
******************************************************************************/

void spi_write(int registerAddress, int nbytes, char data, int file)
{
 unsigned char buf[32];
 int status;


 memset(buf, 0, sizeof buf);
 buf[0] = 0x80 | registerAddress;
 buf[1] = 0x80 & registerAddress;
 buf[2] = data;
 xfer[0].tx_buf = (unsigned long)buf;
 xfer[0].len = nbytes + 2; /* Length of command to write*/
 status = ioctl(file, SPI_IOC_MESSAGE(1), xfer);
 if (status < 0)
 {
 perror("SPI_IOC_MESSAGE");
 return;
 }

 com_serial=1;
 failcount=0;
}

 

 

Below is the write operation which writes the value 0x3D to the CTRL_REG1 (0x2A).

 

194664_194664.jpgSPI Write.JPG.jpg

 

Read

 

Similarly a read operation is initiated by transmitting a 0 for the R/W bit. Then the 8-bit register address, ADDR[7:0] is encoded in the first and second serialized bytes. The data is read from the MISO pin (MSB first).

 

In this case the array buf keeps the address that is going to be read and the third byte is just a dummy byte to be transferred. Structure xfer keeps transfer buffer pointer which in this case is buf and receive buffer which is AccData, the lenght of the command to write and the length of data to read is also specified and finally the read command is executed with ioctl call.

 

 

/********************** Read a byte from the FXLS8471Q *********************** 
* Byte 0: 0,ADDR[6],ADDR[5],ADDR[4],ADDR[3],ADDR[2],ADDR[1],ADDR[0] 
* Byte 1: ADDR[7],0,0,0,0,0,0,0 
* Byte 2: 0,0,0,0,0,0,0,0 
******************************************************************************/

char * spi_read(int registerAddress, int nbytes, int file)
{
 int status;

 memset(buf, 0, sizeof buf);
 memset(AccData, 0, sizeof AccData);
 buf[0] = 0x7F & registerAddress;
 buf[1] = 0x80 & registerAddress;
 buf[2] = 0x00;
 xfer[0].tx_buf = (unsigned long)buf;
 xfer[0].len = 2; /* Length of command to write*/
 xfer[1].rx_buf = (unsigned long) AccData;
 xfer[1].len = nbytes; /* Length of Data to read */
 xfer[1].speed_hz = 524250;
 status = ioctl(file, SPI_IOC_MESSAGE(2), xfer);
 if (status < 0)
 {
 perror("SPI_IOC_MESSAGE");
 return 0;
 }

 com_serial=1;
 failcount=0;
 return AccData;
}

 

 

The screenshot below shows the read operation which reads the correct value 0x6A from the WHO_AM_I register (0x0D).

 

194665_194665.jpgSPI Read.JPG.jpg

 

Building and Run the SPI Application Driver

 

In order to build the application please save the source files and the Makefile (attached) on any place on your host machine and go to that directory where you saved them. Then build the application with the Meta-toolchain using the Make file with the following commands.

 

Build application driver

$ cd <folder wher spi device driver source is saved>

$ source /opt/fsl-imx-x11/<kernel version>/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi

$ make

 

A spi_test file will be created in the same folder, copy this file into the sdcard on the Root File System partition in /home/root. Finally when booting the target execute the application. You must see the following output.

 

 

196104_196104.pngpastedImage_4.png

 

Conclusion

 

This document summarizes the steps to create a SPI application driver. As you saw it is necessary to rebuild the device tree and the kernel, and to do this it is necessary to install metatoolchain. The application driver uses the SPI kernel driver and its main functions are next:

  • Init SPI Driver
  • Read
  • Write
  • Init sensor
  • Callibrate Sensor
  • Polling data ready function

 

I would say that the core of the application driver are the read and write functions which configure the SPI kernel driver and pass data to it in the format required by the sensor.

 

For specific details on the driver please see the attached .zip file which contains the application driver code, the Makefile with the one it is build and the device tree sources.

 

I hope you find this document useful.

 

 

Carlos

Attachments
%3CLINGO-SUB%20id%3D%22lingo-sub-1126446%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EInterfacing%20FXLS8471Q%20with%20i.MX6Q%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1126446%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22toc%22%3E%3CUL%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Introduction%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EIntroduction%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Hardware_Connections%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EHardware%20Connections%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Device_Tree_Configuration%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EDevice%20Tree%20Configuration%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Rebuilding_Image_%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ERebuilding%20Image%20%3C%2FA%3E%3CUL%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Requirements%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ERequirements%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Kernel_%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EKernel%20%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Device_Tree%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EDevice%20Tree%3C%2FA%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Application_Driver%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EApplication%20Driver%3C%2FA%3E%3CUL%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Main%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EMain%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Init_Driver%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EInit%20Driver%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Write%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EWrite%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Read%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ERead%3C%2FA%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Building_and_Run_the_SPI_Application_Driver%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EBuilding%20and%20Run%20the%20SPI%20Application%20Driver%3C%2FA%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3E%3CA%20class%3D%22jive-link-anchor-small%22%20href%3D%22%23jive_content_id_Conclusion%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EConclusion%3C%2FA%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FDIV%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Introduction%22%20id%3D%22toc-hId-382514737%22%20id%3D%22toc-hId-1297602097%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3EIntroduction%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EThis%20document%20describes%20how%20to%20interface%20and%20use%20%3CA%20_jive_internal%3D%22true%22%20class%3D%22%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fhttp%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Ffact-sheet%2FFXLS8471QFS.pdf%22%20target%3D%22_blank%22%3EXtrinsic%20FXLS8471Q%20digital%20accelerometer%3C%2FA%3E%20with%20IMX6Q%20processor.%20For%20this%20purpose%2C%20UDOO%20Quad%20board%20is%20used%20with%20NXP%20Linux%20image%20for%20IMX6QSABRE-SD%20board%20with%20Kernel%203.14.56%20(not%20with%20Udoobuntu)%20to%20simulate%20working%20with%20a%20custom%20board%2C%20the%20process%20to%20customize%20and%20build%20such%20image%20for%20UDOO%20Quad%20board%20is%20described%20here%3A%20%3CA%20_jive_internal%3D%22true%22%20data-containerid%3D%222004%22%20data-containertype%3D%2214%22%20data-objectid%3D%22332807%22%20data-objecttype%3D%22102%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-332807%22%20target%3D%22_blank%22%3EBuilding%20Linux%20Image%20with%20QT5%20for%20UDOO%20Quad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EOn%20the%20sensor%20side%20%3CA%20class%3D%22jive-link-external-small%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fexternal-link.jspa%3Furl%3Dhttp%253A%252F%252Fwww.freescale.com%252Fwebapp%252Fsps%252Fsite%252Fprod_summary.jsp%253Fcode%253DFRDM-FXS-MULTI-B%22%20target%3D%22_blank%22%3EFRDM-FXS-MULTI(-B)%20sensor%20expansion%20board%3C%2FA%3E%20which%20features%20many%20of%20the%20Xtrinsic%20sensors%20introduced%20in%202013%20including%20the%20%3CA%20_jive_internal%3D%22true%22%20class%3D%22%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fhttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fdata-sheet%2FFXLS8471Q.pdf%22%20target%3D%22_blank%22%3EFXSL8471Q%3C%2FA%3E%20is%20used.%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3CSTRONG%3E%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Hardware_Connections%22%20id%3D%22toc-hId--1424939726%22%20id%3D%22toc-hId--509852366%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3EHardware%20Connections%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3BThe%20SPI%20signals%20from%20FRDM-FXS-MULTI%20are%20routed%20to%20SPI1%20module%20of%20UDOO%20Quad.%20FXLS8471Q%20provides%20an%20INT%20pin%20which%20is%20indicated%20on%20image%20below%2C%20however%20on%20this%20implementation%20polling%20method%20is%20used.%20Please%20note%20that%20Chip%20Select%20is%20not%20controlled%20automatically%20by%20SPI%20module%2C%20therefore%20this%20pin%20is%20configured%20as%20GPIO.%20Besides%20these%20signals%2C%20reset%20and%20power%20source%20pins%20were%20also%20connected.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%20margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EThe%20following%20figure%20shows%20the%20pins%20used%20in%20FRDM-FXS-MULTI%20which%20are%20connected%20with%20UDOO%20Quad%20%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3Eboard%3C%2FSPAN%3E.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193531_193531.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193531_193531.png%22%20style%3D%22width%3A%20470px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118021i43FE01ADD2B27B44%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22193531_193531.png%22%20alt%3D%22193531_193531.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_11.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_11.png%22%20style%3D%22width%3A%20470px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79740iC32391A67C1D9577%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_11.png%22%20alt%3D%22pastedImage_11.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20pins%20used%20on%20the%20UDOO%20Quad%20side%20are%20shown%20in%20the%20images%20below.%20You%20can%20find%20UDOO%20Quad%20pinout%20diagram%20here%20%3CA%20_jive_internal%3D%22true%22%20class%3D%22%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fhttps%3A%2F%2Fwww.udoo.org%2Fdownload%2Ffiles%2Fpinout%2F%22%20target%3D%22_blank%22%3EIndex%20of%20%2Fdownload%2Ffiles%2Fpinout%3C%2FA%3E.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193533_193533.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193533_193533.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118022i89F1F8DF013B3936%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22193533_193533.png%22%20alt%3D%22193533_193533.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222017-09-05_18-02-20.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222017-09-05_18-02-20.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79739i23AACBF7C21E55E5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222017-09-05_18-02-20.png%22%20alt%3D%222017-09-05_18-02-20.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193532_193532.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193532_193532.png%22%20style%3D%22width%3A%20688px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118023iD5C9037D486A2F47%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22193532_193532.png%22%20alt%3D%22193532_193532.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_15.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_15.png%22%20style%3D%22width%3A%20688px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F24955iB946B837EF58EFD2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_15.png%22%20alt%3D%22pastedImage_15.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Device_Tree_Configuration%22%20id%3D%22toc-hId-1062573107%22%20id%3D%22toc-hId-1977660467%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3EDevice%20Tree%20Configuration%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20mentioned%20at%20the%20beginning%20of%20this%20document%2C%20a%20NXP%20Linux%20image%20for%20IMX6Q-SABRESD%20is%20used.%20In%20order%20to%20customize%20this%20image%20to%20be%20used%20with%20the%20UDOO%20Quad%20board%20it%20is%20necessary%20to%20build%20a%20.dtb%20that%20matches%20with%20it.%20This%20task%20was%20accomplished%20obtaining%20dts%20and%20dtsi%20source%20files%20listed%20below%20from%20Kernel%20Linux%20Repository%20for%20UDOO%20at%20%3CA%20_jive_internal%3D%22true%22%20class%3D%22%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fhttps%3A%2F%2Fgithub.com%2FUDOOboard%22%20target%3D%22_blank%22%3EUDOOboard%20(UDOOboard)%20%C2%B7%20GitHub%3C%2FA%3E.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3Eimx6qdl-udoo.dtsi%3C%2FLI%3E%3CLI%3Eimx6qdl-udoo-externalpins.dtsi%3C%2FLI%3E%3CLI%3Eimx6q-udoo-hdmi.dts%3C%2FLI%3E%3C%2FUL%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThese%20files%20were%20copied%20into%20the%26nbsp%3BIMX6Q-SABRESD%20build%20source%20folder%20and%20a%26nbsp%3Bimx6q-udoo.dtb%20was%20generated.%20This%20process%20is%20described%20on%20%3CA%20_jive_internal%3D%22true%22%20data-containerid%3D%222004%22%20data-containertype%3D%2214%22%20data-objectid%3D%22332807%22%20data-objecttype%3D%22102%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fdocs%2FDOC-332807%22%20target%3D%22_blank%22%3EBuilding%20Linux%20Image%20with%20QT5%20for%20UDOO%20Quad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20snippets%20show%20how%20the%20nodes%20involved%20on%20the%20SPI%20configuration%20were%20set%20for%20UDOO%20Quad%20board.%20Please%20note%20that%20each%20device%20tree%20should%20match%20your%20custom%20board.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20%3CEM%3E%3CSTRONG%3Eimx6qdl-udoo-externalpins.dtsi%20%3C%2FSTRONG%3E%3C%2FEM%3Everify%20that%20%3CEM%3E%3CSTRONG%3Eecspi1%3C%2FSTRONG%3E%3C%2FEM%3E%20node%20matches%20with%20the%20one%20shown%20below.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-none%20line-numbers%22%3E%3CCODE%3E%26amp%3Becspi1%20%7B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bfsl%2Cspi-num-chipselects%20%3D%20%26lt%3B1%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bcs-gpios%20%3D%20%26lt%3B%26amp%3Bgpio5%2017%200%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bpinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_ecspi1%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bpinctrl-names%20%3D%20%22default%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bstatus%20%3D%20%22disabled%22%3B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%20spidev0%3A%20spi%400%20%7B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%23address-cells%20%3D%20%26lt%3B1%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%23size-cells%20%3D%20%26lt%3B1%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bcompatible%20%3D%20%22spidev%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Breg%20%3D%20%26lt%3B0%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bspi-max-frequency%20%3D%20%26lt%3B2000000%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%7D%3B%0A%7D%3B%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20can%20see%20on%20snippet%20above%2C%20%3CEM%3E%3CSTRONG%3Eecspi1%3C%2FSTRONG%3E%3C%2FEM%3E%20node%20uses%20%3CEM%3E%3CSTRONG%3Epinctrl_ecspi1%3C%2FSTRONG%3E%3C%2FEM%3E%20as%20the%20pin%20configuration%20node%20which%20is%20defined%20in%20the%20same%20file%20and%20it%20looks%20as%20follows.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-none%20line-numbers%22%3E%3CCODE%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pinctrl_ecspi1%3A%20ecspi1grp%20%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fsl%2Cpins%20%3D%20%26lt%3B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT22__ECSPI1_MISO%26nbsp%3B%200x100b1%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT20__ECSPI1_SCLK%26nbsp%3B%200x100b1%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT21__ECSPI1_MOSI%26nbsp%3B%200x100b1%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17%26nbsp%3B%26nbsp%3B%200x80000000%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3B%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20as%20you%20may%20know%20each%20pin%20on%20i.MX%20devices%20has%20up%20to%208%20potential%20functions%2C%20and%20on%20the%20other%20side%2C%20one%20function%20can%20be%20available%20in%20different%20pins.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%2C%20ECSPI1_MISO%20can%20be%20mapped%20to%204%20different%20pins%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193535_193535.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22193535_193535.png%22%20style%3D%22width%3A%20767px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118024i3879894BF96F8445%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22193535_193535.png%22%20alt%3D%22193535_193535.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_31.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_31.png%22%20style%3D%22width%3A%20767px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F28981i164CC74063522892%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_31.png%22%20alt%3D%22pastedImage_31.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20each%20pin%20can%20have%20different%20functions.%20From%20all%20the%20available%20functions%20in%20a%20pin%20one%20is%20chosen%20to%20be%20the%20pad%20(pin)%20name.%20In%20the%20image%20below%20DISP0_DATA22%20was%20chosen%20to%20be%20the%20pad%20name.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20center%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194454_194454.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194454_194454.png%22%20style%3D%22width%3A%20669px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118025i4CD86BA2DB0C8BB6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22194454_194454.png%22%20alt%3D%22194454_194454.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_2.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_2.png%22%20style%3D%22width%3A%20669px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79738iEE99DBC807EE2CEA%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_2.png%22%20alt%3D%22pastedImage_2.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20back%20to%20%3CEM%3E%3CSTRONG%3Epinctrl_ecspi1%20%3C%2FSTRONG%3E%3C%2FEM%3Enode%3CEM%3E%3CSTRONG%3E%2C%20%3C%2FSTRONG%3E%3C%2FEM%3Ethe%20macros%20used%20here%20are%20defined%20in%3CEM%3E%3CSTRONG%3E%20imx6q-pinfuc.h%2C%20%3C%2FSTRONG%3E%3C%2FEM%3Eas%20you%20can%20see%3CEM%3E%20%3C%2FEM%3EDISP0_DAT20%20-%20DISP0_DAT23%20are%20the%20pads%20used%20with%20the%20ECSPI%20signals.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20necessary%20to%20check%20it%20that%20there%20are%20no%20other%20configurations%20for%20DISP0_DAT20%20-%20DISP0_DAT23%20and%20if%20they%20are%20it%20is%20necessary%20to%20comment%20out%20them%20or%20delete%20them.%20In%20this%20case%20there%20were%20other%20configurations%20for%20these%20pins%20in%20%3CEM%3E%3CSTRONG%3Eimx6qdl-udoo-externalpins.dtsi%20%3C%2FSTRONG%3E%3C%2FEM%3Eand%20they%20were%20commented%20out.%3CEM%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-none%20line-numbers%22%3E%3CCODE%3E%26amp%3Biomuxc%20%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%20imx6q-udoo%20%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20External%20Pinout%20GPIOs%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20external_hog%3A%20hoggrp-2%20%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fsl%2Cpins%20%3D%20%26lt%3B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT11__GPIO5_IO29%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-0%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT10__GPIO5_IO28%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-1%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_CLK__GPIO1_IO20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-2%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_DAT0__GPIO1_IO16%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-3%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_DAT1__GPIO1_IO17%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-4%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_CMD__GPIO1_IO18%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-5%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD4_DAT1__GPIO2_IO09%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-6%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD4_DAT2__GPIO2_IO10%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-7%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_DAT3__GPIO1_IO21%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-8%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD1_DAT2__GPIO1_IO19%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-9%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_1__GPIO1_IO01%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-10%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_9__GPIO1_IO09%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-11%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_3__GPIO1_IO03%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-12%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_SD4_DAT0__GPIO2_IO08%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-13%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT4__GPIO5_IO22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-14%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT16__GPIO6_IO02%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-15%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT14__GPIO6_IO00%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-16%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT15__GPIO6_IO01%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-17%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-18%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-19%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_D28__GPIO3_IO28%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-20%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_D21__GPIO3_IO21%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-21%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT6__GPIO4_IO27%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-22%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT7__GPIO4_IO28%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-23%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT8__GPIO4_IO29%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-24%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-25%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT10__GPIO4_IO31%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-26%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-27%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT12__GPIO5_IO06%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-28%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT13__GPIO5_IO07%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-29%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT14__GPIO5_IO08%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-30%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-31%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT16__GPIO5_IO10%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-32%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT17__GPIO5_IO11%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-33%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-34%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_DISP0_DAT19__GPIO5_IO13%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-35%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FMX6QDL_PAD_DISP0_DAT20__GPIO5_IO14%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-36%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FMX6QDL_PAD_DISP0_DAT21__GPIO5_IO15%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-37%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_A16__GPIO2_IO22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-38%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_18__GPIO7_IO13%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-39%7D%7D%20(KEY_VOL_UP)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_NANDF_D0__GPIO2_IO00%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-40%7D%7D%20(HOME)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_NANDF_D3__GPIO2_IO03%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-41%7D%7D%20(SEARCH)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_NANDF_D2__GPIO2_IO02%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-42%7D%7D%20(BACK)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_NANDF_D1__GPIO2_IO01%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-43%7D%7D%20(MENU)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_19__GPIO4_IO05%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-44%7D%7D%20(KEY_VOL_DOWN)%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20MX6QDL_PAD_DISP0_DAT22__GPIO5_IO16%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-45%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2FMX6QDL_PAD_DISP0_DAT23__GPIO5_IO17%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-46%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_D25__GPIO3_IO25%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-47%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_KEY_ROW1__GPIO4_IO09%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-48%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_KEY_COL1__GPIO4_IO08%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-49%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_OE__GPIO2_IO25%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-50%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_CS1__GPIO2_IO24%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-51%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_CS0__GPIO2_IO23%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-52%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_EIM_D24__GPIO3_IO24%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-53%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_8__GPIO1_IO08%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-54%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MX6QDL_PAD_GPIO_7__GPIO1_IO07%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%200x80000000%26nbsp%3B%20%2F%2F%20%7B%7Bexternal-gpio-55%7D%7D%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3B%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFinally%2C%20in%20%3CEM%3E%3CSTRONG%3Eimx6q-udoo-hdmi.dts%3C%2FSTRONG%3E%3C%2FEM%3E%20enable%20ECSPI%20by%20including%20an%20ecspi1%20node%20reference%20and%20setting%20the%20status%20property%20to%20%22okay%22.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-none%20line-numbers%22%3E%3CCODE%3Edts-v1%2F%3B%0A%23include%20%22imx6q.dtsi%22%0A%23include%20%22imx6qdl-udoo.dtsi%22%0A%23include%20%22imx6qdl-udoo-externalpins.dtsi%22%0A%0A%2F%20%7B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bmodel%20%3D%20%22UDOO%20Quad%20Board%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bcompatible%20%3D%20%22udoo%2Cimx6q-udoo%22%2C%20%22fsl%2Cimx6q%22%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bmxcfb1%3A%20fb%400%20%7B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bcompatible%20%3D%20%22fsl%2Cmxc_sdc_fb%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bdisp_dev%20%3D%20%22hdmi%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Binterface_pix_fmt%20%3D%20%22RGB24%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bmode_str%20%3D%221920x1080M%4060%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bdefault_bpp%20%3D%20%26lt%3B32%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bint_clk%20%3D%20%26lt%3B0%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Blate_init%20%3D%20%26lt%3B0%26gt%3B%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bstatus%20%3D%20%22okay%22%3B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%7D%3B%0A%7D%3B%0A%0A%0A%26amp%3Becspi1%20%7B%0A%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bstatus%20%3D%20%22okay%22%3B%0A%7D%3B%0A%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20This%20could%20be%20done%20in%20.dtsi%20but%20the%20side%20effect%20is%20that%20any%20configuration%20including%20the%20dtsi%20will%20have%20ECSPI1%20enabled%20by%20default.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFinally%20it%20is%20necessary%20to%20rebuild%20the%20device%20tree%20and%20copy%20it%20to%20the%20FAT%20partition%20of%20the%20sdcard.%20This%20process%20is%20explained%20in%20next%20section.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Rebuilding_Image_%22%20id%3D%22toc-hId--744881356%22%20id%3D%22toc-hId-170206004%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3ERebuilding%20Image%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22jive_content_id_Requirements%22%20id%3D%22toc-hId--54319882%22%20id%3D%22toc-hId-860767478%22%3E%3CSPAN%20style%3D%22font-size%3A%2022px%3B%22%3ERequirements%3C%2FSPAN%3E%3C%2FH2%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3EIn%20order%20to%20build%20an%20image%20as%20well%20as%20an%20application%20it%20is%20necessary%20to%20install%20a%20tool%20to%20cross-compile%20code%2C%20this%20way%20we%20will%20be%20able%20to%20generate%20executable%20files%20for%20ARM%20architecture%20in%20our%20host%20machine.%20This%20tool%20is%20called%20meta-toolchain%2C%20the%20following%20commands%20are%20used%20to%20install%20it.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3EIn%20the%20following%20instructions%20it%20is%20considered%20that%20the%20build%20directory%20is%20~%2Ffsl-release_bsp%2Fbuild_imx6qsabresd_qt5%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3E%3CSTRONG%3E%24%20cd%20~%2Ffsl-release_bsp%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3E%3CSTRONG%3E%24%20source%20setup-environment%20build_imx6qsabresd_qt5%3C%2FSTRONG%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3E%3CSTRONG%3E%24%20bitbake%20meta-toolchain%3CBR%20%2F%3E%24%20sh%20tmp%2Fdeploy%2Fsdk%2Ffsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-%3CKERNEL%3E.sh%3C%2FKERNEL%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1861774345%22%20id%3D%22toc-hId--1861774345%22%20id%3D%22toc-hId--946686985%22%3E%3C%2FH2%3E%3CH2%20id%3D%22jive_content_id_Kernel_%22%20id%3D%22toc-hId-625738488%22%20id%3D%22toc-hId-1540825848%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2022px%3B%22%3EKernel%3C%2FSPAN%3E%20%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20order%20to%20enable%20the%20kernel%20SPI%20driver%20it%20is%20necessary%20to%20set%20it%20in%20the%20menuconfig%20and%20rebuild%20zImage.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGo%20to%20kernel%20directory%20within%20the%20Yocto%20build%20directory%20that%20we%20created.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20cd%20%3CBUILD_DIRECTORY%3E%2Ftmp%2Fwork-shared%2Fimx6qsabresd%2Fkernel-source%24%3C%2FBUILD_DIRECTORY%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELaunch%20menuconfig%20for%20imx%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20source%20%2Fopt%2Ffsl-imx-x11%2F%3CKERNEL%20version%3D%22%22%3E%2Fenvironment-setup-armv7a-vfp-neon-poky-linux-gnueabi%3C%2FKERNEL%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20imx_v7_defconfig%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20menuconfig%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEnable%20SPI%20Driver%20by%20going%20to%20Device%20Drivers%20--%26gt%3B%20SPI%20Support%20and%20seting%20'*'%20to%20SPI%20device%20Driver%2C%20save%20changes%20and%20then%20exit.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194542_194542.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194542_194542.png%22%20style%3D%22width%3A%20722px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118026iB55F9094A8AF1330%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22194542_194542.png%22%20alt%3D%22194542_194542.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22menuconfig_spi.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22menuconfig_spi.png%22%20style%3D%22width%3A%20722px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79741iAFC086FF8AD4904C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22menuconfig_spi.png%22%20alt%3D%22menuconfig_spi.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20build%20zImage%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20zImage%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20generated%20file%20is%20located%20in%20%3CSTRONG%3E%3CBUILD_DIRECTORY%3E%2Ftmp%2Fwork-shared%2Fimx6qsabresd%2Fkernel-source%2Farch%2Farm%2Fboot%24%20%3C%2FBUILD_DIRECTORY%3E%3C%2FSTRONG%3Eand%20it%20must%20be%20copied%20to%20the%20FAT%20partition%20of%20the%20SD%20card.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22jive_content_id_Device_Tree%22%20id%3D%22toc-hId--1181715975%22%20id%3D%22toc-hId--266628615%22%3E%3CSPAN%20style%3D%22font-size%3A%2022px%3B%22%3EDevice%20Tree%3C%2FSPAN%3E%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2015px%3B%22%3ETo%20build%20the%20device%20tree%20%3C%2FSPAN%3Ego%20to%20kernel%20directory%20within%20the%20Yocto%20build%20directory%20that%20we%20created.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20cd%20%3CBUILD_DIRECTORY%3E%2Ftmp%2Fwork-shared%2Fimx6qsabresd%2Fkernel-source%24%3C%2FBUILD_DIRECTORY%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBuild%20dtb%20file%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20source%20%2Fopt%2Ffsl-imx-x11%2F%3CKERNEL%20version%3D%22%22%3E%2Fenvironment-setup-armv7a-vfp-neon-poky-linux-gnueabi%3C%2FKERNEL%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20imx_v7_defconfig%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20imx6q-udoo-hdmi.dtb%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20generated%20file%20is%20located%20in%20%3CSTRONG%3E%3CBUILD_DIRECTORY%3E%2Ftmp%2Fwork-shared%2Fimx6qsabresd%2Fkernel-source%2Farch%2Farm%2Fboot%2Fdts%24%20%3C%2FBUILD_DIRECTORY%3E%3C%2FSTRONG%3Eand%20it%20must%20be%20renamed%20as%20%3CSTRONG%3Eimx6q-udoo.dtb%3C%2FSTRONG%3E%20and%20copied%20to%20the%20FAT%20partition%20of%20the%20SD%20card.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Application_Driver%22%20id%3D%22toc-hId--1192219079%22%20id%3D%22toc-hId--277131719%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3EApplication%20Driver%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20SPI%20kernel%20driver%20uses%20a%20structure%20named%20%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3Espi_ioc_transfer%3C%2FSTRONG%3E%20which%20describes%20a%20single%20SPI%20transfer.%20It%20holds%20pointers%20to%20userspace%20buffers%20with%20transmit%20and%20receive%20data%2C%20length%20of%20buffers%2C%20speed%2C%20bits%20per%20word%20among%20other%20configurations.%20For%20further%20details%20you%20can%20refer%20to%20%3CSTRONG%3E%2Finclude%2Fuapi%2Flinux%2Fspi%2Fspidev.h%3C%2FSTRONG%3E%20on%20your%20kernel%20source.%3C%2FSPAN%3E%20In%20the%20next%20section%20the%20application%20driver%20is%20explained.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20source%20files%20of%20the%20application%20driver%20as%20well%20as%20the%20device%20tree%20sources%20can%20be%20found%20in%20the%20attached.zip%20file.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22jive_content_id_Main%22%20id%3D%22toc-hId--501657605%22%20id%3D%22toc-hId-413429755%22%3EMain%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20code%20shows%20function%20main%20where%20the%20SPI%20driver%20is%20initialized%20driver%20using%20%3CSTRONG%3E%22%2Fdev%2Fspidev0.0%22%3C%2FSTRONG%3E%20which%20is%20listed%20under%20%3CSTRONG%3E%2Fdev%20%3C%2FSTRONG%3E(in%20the%20target%20root%20file%20system)%20after%20SPIdev%20driver%20is%20enabled%20in%20menuconfig%20and%20kernel%20is%20rebuilt%20as%20indicated%20in%20previous%20section.%20Then%20it%20reads%20who%20am%20i%20register%20just%20for%20sanity%20check%20purpose%20and%20initializes%20and%20calibrates%20the%20sensor%20and%20enters%20in%20an%20endless%20loop%20where%20it%20reads%20the%20sensor%20whenever%20there%20is%20new%20data%20ready.%20Raw%20data%20is%20returned%20in%206%20bytes%2C%20so%20it%20is%20managed%20to%20get%20X%2C%20Y%20and%20Z%20values%20and%20finally%20these%20values%20are%20converted%20to%20G's%20values%20and%20it%20waits%20until%20a%20key%20is%20pressed%20to%20continue%20to%20read%20the%20following%20value.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-c%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F******************************************************************************%20*%20Main%20******************************************************************************%2F%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Emain%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FenableGPIO()%3B%20%2F%2FIn%20case%20of%20using%20interrupt%20instead%20of%20polling%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20file%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Espi_init%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22%2Fdev%2Fspidev0.0%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdev%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Ewho%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EFXLS8471Q_Init%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EFXLS8471Q_Calibration%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22keyword%20token%22%3Ewhile%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EcheckData%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EDataReady%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Is%20a%20new%20set%20of%20data%20ready%3F%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20buffer%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Espi_read%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EOUT_X_MSB_REG%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E6%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20file%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Read%20data%20output%20registers%200x01-0x06%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22AccData%5B0%5D%20%3D%200x%25X%20%5Cn%20AccData%5B1%5D%20%3D%200x%25X%20%5Cn%20AccData%5B2%5D%20%3D%200x%25X%20%5Cn%20AccData%5B3%5D%20%3D%200x%25X%20%5Cn%20AccData%5B4%5D%20%3D%200x%25X%20%5Cn%20AccData%5B5%5D%20%3D%200x%25X%20%5Cn%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E3%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E5%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xout_14_bit%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eshort%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EAccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%26gt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%2014-bit%20X-axis%20output%20value%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yout_14_bit%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eshort%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EAccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E3%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%26gt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%2014-bit%20Y-axis%20output%20value%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zout_14_bit%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eshort%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EAccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E5%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%26gt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%2014-bit%20Z-axis%20output%20value%3C%2FSPAN%3E%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Xout_g%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Efloat%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20Xout_14_bit%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3E%20SENSITIVITY_2G%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%20X-axis%20output%20value%20in%20g's%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Yout_g%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Efloat%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20Yout_14_bit%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3E%20SENSITIVITY_2G%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%20Y-axis%20output%20value%20in%20g's%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Zout_g%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Efloat%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20Zout_14_bit%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3E%20SENSITIVITY_2G%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20Compute%20Z-axis%20output%20value%20in%20g's%3C%2FSPAN%3E%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fprintf(%22%20X%20%3D%20%25d%20Y%20%3D%20%25d%20Z%20%3D%20%25d%20%5Cn%5Cn%22%2C%20AccData%5B0%5D%2C%20AccData%5B2%5D%2C%20AccData%5B4%5D)%3B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fprintf(%22Xval%20%3D%20%25d%20Yval%20%3D%20%25d%20Zval%20%3D%20%25d%20%5Cn%22%2C%20Xout_14_bit%2C%20Yout_14_bit%2C%20Zout_14_bit)%3B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22%20XG%20%3D%20%25f%20YG%20%3D%20%25f%20ZG%20%3D%20%25f%20%5Cn%5Cn%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20Xout_g%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20Yout_g%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20Zout_g%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Egetchar%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Eclose%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CH2%20id%3D%22toc-hId--635342329%22%20id%3D%22toc-hId--635342329%22%20id%3D%22toc-hId-279745031%22%3E%3C%2FH2%3E%3CH2%20id%3D%22jive_content_id_Init_Driver%22%20id%3D%22toc-hId-1852170504%22%20id%3D%22toc-hId--1527709432%22%3EInit%20Driver%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%3CSTRONG%3Espi_init%3C%2FSTRONG%3E%20function%20opens%20a%20file%20for%20the%20driver%20%3CSTRONG%3E%22%2Fdev%2Fspidev0.0%22%20%3C%2FSTRONG%3Ewhich%20is%20passed%20as%20a%20parameter%20from%20main()%2C%20then%20the%20SPI%20configuration%20parameters%20are%20read%20just%20for%20informative%20purpose.%20Finally%20struct%20%3CSTRONG%3Exfer%3C%2FSTRONG%3E%26nbsp%3Bwhich%20is%20of%20type%20%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3Espi_ioc_transfer%3C%2FSTRONG%3E%3C%2FSPAN%3E%20is%20initialized.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-c%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F*********************************%20SPIdev%20Init%20**********************************************%2F%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Espi_init%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20filename%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E40%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20file%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20mode%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20lsb%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20bits%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20baudrate%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E524250%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20speed%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20Init%20%5Cn%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Eopen%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efilename%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3EO_RDWR%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22Failed%20to%20open%20the%20bus.%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20ERROR%20HANDLING%3B%20you%20can%20check%20errno%20to%20see%20what%20went%20wrong%20*%2F%3C%2FSPAN%3E%0A%20com_serial%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eexit%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20SPI_IOC_RD_MODE%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3Emode%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20rd_mode%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%20%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20SPI_IOC_RD_LSB_FIRST%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3Elsb%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20rd_lsb_fist%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%20%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20SPI_IOC_RD_BITS_PER_WORD%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3Ebits%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20bits_per_word%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%20%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20SPI_IOC_RD_MAX_SPEED_HZ%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3Espeed%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20max_speed_hz%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22%25s%3A%20spi%20mode%20%25d%2C%20%25d%20bits%20%25s%20per%20word%2C%20%25d%20Hz%20max%5Cn%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3Efilename%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20mode%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20bits%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20lsb%20%3CSPAN%20class%3D%22operator%20token%22%3E%3F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22string%20token%22%3E%22LSB%20first%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22string%20token%22%3E%22MSB%20first%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20baudrate%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Elen%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E3%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Length%20of%20command%20to%20write*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecs_change%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Keep%20CS%20activated%20*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Edelay_usecs%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdelay%20in%20us%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Espeed_hz%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E524250%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fspeed%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ebits_per_word%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20bites%20per%20word%208%3C%2FSPAN%3E%0A%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Elen%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Length%20of%20Data%20to%20read%20*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecs_change%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Keep%20CS%20activated%20*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Edelay_usecs%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Espeed_hz%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E524250%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ebits_per_word%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eprintf%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI%20Init%20Finished%20%5Cn%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20file%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22jive_content_id_Write%22%20id%3D%22toc-hId-44716041%22%20id%3D%22toc-hId-959803401%22%3E%3CSPAN%20style%3D%22font-size%3A%2022px%3B%22%3EWrite%3C%2FSPAN%3E%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EThe%20SPI%20communication%20is%20started%20with%20the%26nbsp%3B%20falling%20edge%20on%20chip%20select%20pin.%20A%20write%20operation%20is%20initiated%20by%20transmitting%20a%201%20for%20the%20R%2FW%20bit.%20Then%20the%208-bit%20register%20address%2C%20ADDR%5B7%3A0%5D%20is%20encoded%20in%20the%20first%20and%20second%20serialized%20bytes.%20Data%20to%20be%20written%20starts%20in%20the%20third%20serialized%20byte.%20The%20order%20of%20the%20bits%20is%20as%20follows%3A%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EByte%200%3A%20R%2FW%2C%20ADDR%5B6%5D%2C%20ADDR%5B5%5D%2C%20ADDR%5B4%5D%2C%20ADDR%5B3%5D%2C%20ADDR%5B2%5D%2C%20ADDR%5B1%5D%2C%20ADDR%5B0%5D%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EByte%201%3A%20ADDR%5B7%5D%2C%20X%2C%20X%2C%20X%2C%20X%2C%20X%2C%20X%2C%20X%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EByte%202%3A%20DATA%5B7%5D%2C%20DATA%5B6%5D%2C%20DATA%5B5%5D%2C%20DATA%5B4%5D%2C%20DATA%5B3%5D%2C%20DATA%5B2%5D%2C%20DATA%5B1%5D%2C%20DATA%5B0%5D%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EThe%20SPI%20communication%20is%20finished%20with%20the%26nbsp%3B%20falling%20edge%20on%20chip%20select%20pin.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20you%20can%20see%20below%20array%20%3CSTRONG%3Ebuf%3C%2FSTRONG%3E%20keeps%20the%20destination%20address%20and%20the%20data%20to%20be%20transferred%2C%20then%20%3CSTRONG%3Exfer%3C%2FSTRONG%3E%20structure%20is%20configured%20to%20point%20to%20%3CSTRONG%3Ebuf%3C%2FSTRONG%3E%20as%20the%20transfer%20buffer%20and%20the%20length%20of%20the%20data%20es%20set%20to%202%20%2B%20data%20size%20(the%20first%202%20bytes%20are%20for%20the%20destination%20address%20which%20is%20splitted%20in%202%20bytes).%20Finally%20the%20transfer%20is%20started%20by%20the%20%3CSTRONG%3Eioctl%3C%2FSTRONG%3E%20command.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-c%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F********************%20Write%20a%20byte%20to%20the%20FXLS8471Q%20***************************%0A*%20Byte%200%3A%201%2CADDR%5B6%5D%2CADDR%5B5%5D%2CADDR%5B4%5D%2CADDR%5B3%5D%2CADDR%5B2%5D%2CADDR%5B1%5D%2CADDR%5B0%5D%20%0A*%20Byte%201%3A%20ADDR%5B7%5D%2C0%2C0%2C0%2C0%2C0%2C0%2C0%20%0A*%20Byte%202%3A%20DATA%5B7%5D%2CDATA%5B6%5D%2CDATA%5B5%5D%2CDATA%5B4%5D%2CDATA%5B3%5D%2CDATA%5B2%5D%2CDATA%5B1%5D%2CDATA%5B0%5D%20%0A******************************************************************************%2F%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Espi_write%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20nbytes%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20data%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20file%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E32%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20status%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%0A%20%3CSPAN%20class%3D%22token%20function%22%3Ememset%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Ebuf%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Esizeof%3C%2FSPAN%3E%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x80%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x80%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20data%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etx_buf%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Elong%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3Ebuf%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Elen%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20nbytes%20%3CSPAN%20class%3D%22operator%20token%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Length%20of%20command%20to%20write*%2F%3C%2FSPAN%3E%0A%20status%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ESPI_IOC_MESSAGE%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Estatus%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI_IOC_MESSAGE%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%0A%20com_serial%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20failcount%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EBelow%20is%20the%20write%20operation%20which%20writes%20the%20value%200x3D%20to%20the%20CTRL_REG1%20(0x2A).%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194664_194664.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194664_194664.jpg%22%20style%3D%22width%3A%20708px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118027iAB707EE7E4C84982%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22194664_194664.jpg%22%20alt%3D%22194664_194664.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI%20Write.JPG.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI%20Write.JPG.jpg%22%20style%3D%22width%3A%20708px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79742iB2EDBC1E2B612C37%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SPI%20Write.JPG.jpg%22%20alt%3D%22SPI%20Write.JPG.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%20margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1762738422%22%20id%3D%22toc-hId--1762738422%22%20id%3D%22toc-hId--847651062%22%3E%3C%2FH2%3E%3CH2%20id%3D%22jive_content_id_Read%22%20id%3D%22toc-hId-724774411%22%20id%3D%22toc-hId-1639861771%22%3ERead%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESimilarly%20a%20read%20operation%20is%20initiated%20by%20transmitting%20a%200%20for%20the%20R%2FW%20bit.%20Then%20the%208-bit%20register%20address%2C%20ADDR%5B7%3A0%5D%20is%20encoded%20in%20the%20first%20and%20second%20serialized%20bytes.%20The%20data%20is%20read%20from%20the%20MISO%20pin%20(MSB%20first).%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20case%20the%20array%20%3CSTRONG%3Ebuf%3C%2FSTRONG%3E%20keeps%20the%20address%20that%20is%20going%20to%20be%20read%20and%20the%20third%20byte%20is%20just%20a%20dummy%20byte%20to%20be%20transferred.%20Structure%20%3CSTRONG%3Exfer%3C%2FSTRONG%3E%20keeps%20transfer%20buffer%20pointer%20which%20in%20this%20case%20is%20%3CSTRONG%3Ebuf%3C%2FSTRONG%3E%20and%20receive%20buffer%20which%20is%20%3CSTRONG%3EAccData%2C%20%3C%2FSTRONG%3Ethe%20lenght%20of%20the%20command%20to%20write%20and%20the%20length%20of%20data%20to%20read%20is%20also%20specified%20and%20finally%20the%20read%20command%20is%20executed%20with%20%3CSTRONG%3Eioctl%3C%2FSTRONG%3E%20call.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22language-c%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F**********************%20Read%20a%20byte%20from%20the%20FXLS8471Q%20***********************%20%0A*%20Byte%200%3A%200%2CADDR%5B6%5D%2CADDR%5B5%5D%2CADDR%5B4%5D%2CADDR%5B3%5D%2CADDR%5B2%5D%2CADDR%5B1%5D%2CADDR%5B0%5D%20%0A*%20Byte%201%3A%20ADDR%5B7%5D%2C0%2C0%2C0%2C0%2C0%2C0%2C0%20%0A*%20Byte%202%3A%200%2C0%2C0%2C0%2C0%2C0%2C0%2C0%20%0A******************************************************************************%2F%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22keyword%20token%22%3Echar%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Espi_read%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20nbytes%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20file%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20status%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%3CSPAN%20class%3D%22token%20function%22%3Ememset%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Ebuf%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Esizeof%3C%2FSPAN%3E%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Ememset%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EAccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Esizeof%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x7F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x80%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20registerAddress%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20buf%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x00%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etx_buf%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Elong%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3Ebuf%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Elen%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Length%20of%20command%20to%20write*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Erx_buf%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Elong%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Elen%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20nbytes%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Length%20of%20Data%20to%20read%20*%2F%3C%2FSPAN%3E%0A%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Espeed_hz%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E524250%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20status%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Eioctl%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Efile%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ESPI_IOC_MESSAGE%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20xfer%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Estatus%20%3CSPAN%20class%3D%22operator%20token%22%3E%26lt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22token%20function%22%3Eperror%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22string%20token%22%3E%22SPI_IOC_MESSAGE%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%0A%0A%20com_serial%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20failcount%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22keyword%20token%22%3Ereturn%3C%2FSPAN%3E%20AccData%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3EThe%20screenshot%20below%20shows%20the%20read%20operation%20which%20reads%20the%20correct%20value%200x6A%20from%20the%20WHO_AM_I%20register%20(0x0D).%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%20margin-bottom%3A%20.0001pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%20.0001pt%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194665_194665.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22194665_194665.jpg%22%20style%3D%22width%3A%20691px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118028i28A026250D9FEC68%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22194665_194665.jpg%22%20alt%3D%22194665_194665.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI%20Read.JPG.jpg%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22SPI%20Read.JPG.jpg%22%20style%3D%22width%3A%20691px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F79743i852E41936E54B29A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SPI%20Read.JPG.jpg%22%20alt%3D%22SPI%20Read.JPG.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1082680052%22%20id%3D%22toc-hId--1082680052%22%20id%3D%22toc-hId--167592692%22%3E%3C%2FH2%3E%3CH2%20id%3D%22jive_content_id_Building_and_Run_the_SPI_Application_Driver%22%20id%3D%22toc-hId-1404832781%22%20id%3D%22toc-hId--1975047155%22%3EBuilding%20and%20Run%20the%20SPI%20Application%20Driver%3C%2FH2%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20order%20to%20build%20the%20application%20please%20save%20the%20source%20files%20and%20the%20Makefile%20(attached)%20on%20any%20place%20on%20your%20host%20machine%20and%20go%20to%20that%20directory%20where%20you%20saved%20them.%20Then%20build%20the%20application%20with%20the%20Meta-toolchain%20using%20the%20Make%20file%20with%20the%20following%20commands.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBuild%20application%20driver%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20cd%20%3CFOLDER%20wher%3D%22%22%20spi%3D%22%22%20device%3D%22%22%20driver%3D%22%22%20source%3D%22%22%20is%3D%22%22%20saved%3D%22%22%3E%3C%2FFOLDER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20source%20%2Fopt%2Ffsl-imx-x11%2F%3CKERNEL%20version%3D%22%22%3E%2Fenvironment-setup-armv7a-vfp-neon-poky-linux-gnueabi%3C%2FKERNEL%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%24%20make%20%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20%3CSTRONG%3Espi_test%3C%2FSTRONG%3E%20file%20will%20be%20created%20in%20the%20same%20folder%2C%20copy%20this%20file%20into%20the%20sdcard%20on%20the%20Root%20File%20System%20partition%20in%20%2Fhome%2Froot.%20Finally%20when%20booting%20the%20target%20execute%20the%20application.%20You%20must%20see%20the%20following%20output.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22196104_196104.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22196104_196104.png%22%20style%3D%22width%3A%20676px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118029iBFC922970B1E3D94%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22196104_196104.png%22%20alt%3D%22196104_196104.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_4.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22pastedImage_4.png%22%20style%3D%22width%3A%20676px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F4064i5B69D51C681F19D5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22pastedImage_4.png%22%20alt%3D%22pastedImage_4.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22jive_content_id_Conclusion%22%20id%3D%22toc-hId--531704401%22%20id%3D%22toc-hId-383382959%22%3E%3CSPAN%20style%3D%22font-size%3A%2030px%3B%22%3E%3CSTRONG%3EConclusion%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH1%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20document%20summarizes%20the%20steps%20to%20create%20a%20SPI%20application%20driver.%20As%20you%20saw%20it%20is%20necessary%20to%20rebuild%20the%20device%20tree%20and%20the%20kernel%2C%20and%20to%20do%20this%20it%20is%20necessary%20to%20install%20metatoolchain.%20The%20application%20driver%20uses%20the%20SPI%20kernel%20driver%20and%20its%20main%20functions%20are%20next%3A%3C%2FP%3E%3CUL%3E%3CLI%3EInit%20SPI%20Driver%3C%2FLI%3E%3CLI%3ERead%3C%2FLI%3E%3CLI%3EWrite%3C%2FLI%3E%3CLI%3EInit%20sensor%3C%2FLI%3E%3CLI%3ECallibrate%20Sensor%3C%2FLI%3E%3CLI%3EPolling%20data%20ready%20function%3C%2FLI%3E%3C%2FUL%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20say%20that%20the%20core%20of%20the%20application%20driver%20are%20the%20read%20and%20write%20functions%20which%20configure%20the%20SPI%20kernel%20driver%20and%20pass%20data%20to%20it%20in%20the%20format%20required%20by%20the%20sensor.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20specific%20details%20on%20the%20driver%20please%20see%20the%20attached%20.zip%20file%20which%20contains%20the%20application%20driver%20code%2C%20the%20Makefile%20with%20the%20one%20it%20is%20build%20and%20the%20device%20tree%20sources.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20you%20find%20this%20document%20useful.%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22min-%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECarlos%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎09-10-2020 03:09 AM
Updated by: