Park Namsu Posted August 7, 2017 Posted August 7, 2017 Hi. Kernel version : 4.11.7-sun8i My trouble is that clk is weird in using spidev. This is a oscilograph when i send a command with spi. First line is CLK and second line is CS0. My slave chip can not receive commands. and I think it due to this weird CLK. CS seems affect CLK. I just want to use spi with CS keeping active-low. But, following code setting mode of spi occured an error. "invalid argument exception" mode = SPI_MODE_1 | SPI_NO_CS; if (ioctl(file,SPI_IOC_WR_MODE32,&mode)<0){ perror("can't set spi mode"); return; } this work properly. mode = SPI_MODE_1; if (ioctl(file,SPI_IOC_WR_MODE32,&mode)<0){ perror("can't set spi mode"); return; } so i used this code setting spi_ioc_transfer. xfer[0].cs_change = 0; /* Keep CS activated */ xfer[0].delay_usecs = 0, //delay in us xfer[0].speed_hz = 12000000, //speed xfer[0].bits_per_word = 8, // bites per word 8 but cs still work and affect clk. this is my /boot/armbianEnv.txt verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 rootdev=UUID=4d25b54f-cc4d-4215-93e3-b5e3868e5a06 rootfstype=ext4 overlays=uart1 uart2 spi-spidev param_spidev_spi_bus=1 param_spidev_spi_cs=1 Thank you.
Recommended Posts