Closed Almaz1c closed 6 years ago
Hi! I am using Mainline kernel 4.14.19-sunxi Debian stretch. I am trying to get SPI's CS pin active low state without luck. I tried it with precompilied image and built from source both. Used HW is orangepi zero.
Here is armbianEnv.txt file:
$ cat /boot/armbianEnv.txt verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 overlays=usbhost2 usbhost3 spi-spidev spi-add-cs1 rootdev=UUID=39059033-9dc5-4bc4-a4d2-61ef949d5b21 rootfstype=ext4 param_spidev_spi_bus=1 param_spidev_spi_cs=1 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
Here is sun8i-h3-spi-spidev.dts file that I converted to dtbo:
/dts-v1/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target-path = "/aliases"; __overlay__ { spi0 = "/soc/spi@01c68000"; spi1 = "/soc/spi@01c69000"; }; }; fragment@1 { target = <0xffffffff>; __overlay__ { #address-cells = <0x1>; #size-cells = <0x0>; spidev { compatible = "spidev"; status = "disabled"; reg = <0x0>; spi-max-frequency = <0xf4240>; }; }; }; fragment@2 { target = <0xffffffff>; __overlay__ { #address-cells = <0x1>; #size-cells = <0x0>; spidev { compatible = "spidev"; status = "ok"; reg = <0x0>; spi-max-frequency = <0xf4240>; }; }; }; __fixups__ { spi0 = "/fragment@1:target:0"; spi1 = "/fragment@2:target:0"; }; };
I see /dev/spidev1.1 device. I see that all overlays are loaded:
/dev/spidev1.1
04 bytes read in 1589 ms (0 Bytes/s) Applying kernel provided DT overlay sun8i-h3-usbhost2.dtbo 504 bytes read in 1614 ms (0 Bytes/s) Applying kernel provided DT overlay sun8i-h3-usbhost3.dtbo 780 bytes read in 1005 ms (0 Bytes/s) Applying kernel provided DT overlay sun8i-h3-spi-spidev.dtbo 1215 bytes read in 1530 ms (0 Bytes/s) Applying kernel provided DT overlay sun8i-h3-spi-add-cs1.dtbo
How I test it:
al@orangepizero:~$ sudo ./spi2 spi mode: 0x0 bits per word: 8 max speed: 500000 Hz (500 KHz) al@orangepizero:~$ sudo ./spi2 -C spi mode: 0x4 bits per word: 8 max speed: 500000 Hz (500 KHz) al@orangepizero:~$ sudo ./spi2 -N can't set spi mode: Invalid argument Aborted
Unfortunately I still see on oscilloscope diagram that CS pin is active HIGH while I need it to be active LOW: https://cloud.mail.ru/public/GSQU/6YarzxVUU
I tried to add SPI-CS-HIGH in spi-spidev.dts for SPI, I tried to change reg<0> to reg<1>. Nothing helped me.
Changing param_spidev_spi_cs=1 to param_spidev_spi_cs=0 gives me Pin24 as CS with active High state
Hi! I am using Mainline kernel 4.14.19-sunxi Debian stretch. I am trying to get SPI's CS pin active low state without luck. I tried it with precompilied image and built from source both. Used HW is orangepi zero.
Here is armbianEnv.txt file:
Here is sun8i-h3-spi-spidev.dts file that I converted to dtbo:
I see
/dev/spidev1.1
device. I see that all overlays are loaded:How I test it:
Unfortunately I still see on oscilloscope diagram that CS pin is active HIGH while I need it to be active LOW: https://cloud.mail.ru/public/GSQU/6YarzxVUU
I tried to add SPI-CS-HIGH in spi-spidev.dts for SPI, I tried to change reg<0> to reg<1>. Nothing helped me.