Hi all, I am recently playing with NanoPi2 running Android (default image provided by manufacturer). I used the matrix lib (https://github.com/friendlyarm/matrix/tree/nanopi2)to do stuff, and I get stuck at Spi library. I followed the demo (https://github.com/friendlyarm/matrix/tree/nanopi2/demo/matrix-0.96_128x...) and do exactly the steps to initialize, write and read bytes from "/dev/spidev0.0". But I got nothing sent. I also connected 19-SPI0_MOSI/GPIOC31, 21-SPI0_MISO/GPIOD0, 23-SPI0_CLK/GPIOC29 pins to oscilloscope to observe the signal, but nothing out,those pins keep silent. I also did some debugs on the software by printf out the spi function parameters, and for "ioctl", it seem to be working not properly. For example: I ran the this function. EXPORT int setSPIDataMode(int spi_fd, int mode) { int ret; int spi_mode = 0; switch(mode) { case SPI_MODE0: spi_mode &= ~(SPI_CPHA|SPI_CPOL); break; case SPI_MODE1: spi_mode &= ~(SPI_CPOL); spi_mode |= (SPI_CPHA); break; case SPI_MODE2: spi_mode |= (SPI_CPOL); spi_mode &= ~(SPI_CPHA); break; case SPI_MODE3: spi_mode |= (SPI_CPHA|SPI_CPOL); break; default: setLastError("error SPIDataMode"); return -1; } ret = ioctl(spi_fd, SPI_IOC_WR_MODE, &mode); if (ret < 0) { LOGI("Can't ioctl SPI_IOC_WR_MODE"); return ret; } LOGI("Successfully ioctl SPI_IOC_WR_MODE: %d", SPI_IOC_WR_MODE); ret = ioctl(spi_fd, SPI_IOC_RD_MODE, &mode); if (ret < 0) { LOGI("Can't ioctl SPI_IOC_RD_MODE"); return ret; } LOGI("Successfully ioctl SPI_IOC_RD_MODE: %d", SPI_IOC_RD_MODE); return ret; } result: Successfully ioctl SPI_IOC_WR_MODE: 1073834753 Successfully ioctl SPI_IOC_RD_MODE: -2147390719 It seems that the second argument of "ioctl" is not correct. Please give me some advises and solutions ! Thank you in advance !
NanoPi2 Android Spi has problem.
Hello, The content of the link is suporrts the debian system nor for android of nanopi 2 , but nanopi2 has spi driver , you can used directly , but you had better to check whether the kernel config already configured the SPI , if not ,you can configure compile to use it again .