shinasys
Posts: 2
Joined: Mon Jun 10, 2019 10:58 am

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

Wed Jul 17, 2019 10:04 am

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");
exit(1);
}
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");
exit(1);
}

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?

wiwi
Posts: 8
Joined: Fri Aug 02, 2019 1:35 pm

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

Wed Nov 27, 2019 6:44 pm

Hello,

I have exactly the same problem with a CM1 board.
I can change the mode with the the SPI0 but not with the SPI2!
I didn't have checked if IOCTL return -1, but spi-config return "SPI_IOC_WR_MODE: Invalid argument".

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

Do you have some news about this?

Best regards,

Wilfrid

User avatar
joan
Posts: 15085
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Wed Nov 27, 2019 6:58 pm

Experiment has demonstrated that modes 1 and 3 do not work on the auxiliary SPI (i.e. the SPI device which uses GPIO 16-21).

wiwi
Posts: 8
Joined: Fri Aug 02, 2019 1:35 pm

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

Wed Nov 27, 2019 7:14 pm

Thanks a lot for the information :) I didn't think to try the others mode.

Wilfrid

Return to “Troubleshooting”