Page 1 of 1

[CM3] spidev spi2.0: setup: unsupported mode bits 1

Posted: Wed Jul 17, 2019 10:04 am
by shinasys
I use CM3, and add dtoverlay=spi2-1cs.

if i change the spi mode to SPI_MODE_1, meet error...
ioctl always return -1.

SPI_MODE_0 have no problem, but set SPI_MODE_1 to CPHA(data is clocked in on falling edge).

my code is general as following :

spi_cs_fd = open("/dev/spidev2.0", O_RDWR);
if (spi_cs_fd < 0)
perror("Error - Could not open SPI device");
status_value = ioctl(spi_cs_fd, SPI_IOC_WR_MODE, &spi_mode); =====> always return -1
if(status_value < 0)
perror("Could not set SPIMode (WR)...ioctl fail");

spidev1.0 and spidev1.1 are all good, but spidev2.0 make error.

error on dmesg is following :
[ 1260.033552] spidev spi2.0: setup: unsupported mode bits 1

How can I solve this problem?