AnsweredAssumed Answered

imx R/W SPI slave device

Question asked by Zongbiao Liao on Jul 22, 2015
Latest reply on Jul 25, 2015 by igorpadykov

Hello,Community

 

I want to R/W a spi slave device on imx6q board.

Could someone tell me the difference between the following code A and B.

 

Code A:

---------------------------------------------

struct spi_ioc_transfer tr[2] = {
     {
      .tx_buf = (unsigned long)tbuf,
      .len = bytes,
  },
 
  {
      .rx_buf = (unsigned long)rbuf,
      .len = bytes,
  }
};

ret = ioctl(fd, SPI_IOC_MESSAGE(2), tr);

-------------------------------------------------

 

Code B:

---------------------------------------------

struct spi_ioc_transfer tr[1] = {
     {
      .tx_buf = (unsigned long)tbuf,

      .rx_buf = (unsigned long)rbuf,
      .len = bytes,
    }
};

ret = ioctl(fd, SPI_IOC_MESSAGE(1), tr);

-------------------------------------------------

 

Thank you!

Best Regards!

Outcomes