Interfacing

Second SPI

1 3053
rrossi  
I'm trying to activate the second SPI on a Banana Pi.
On script.fex I activated SPI1_para and I changed the name of the pins.
[spi1_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = portI16<3><default><default><default>
spi_cs1 = portI15<3><default><default><default>
spi_sclk = portI17<3><default><default><default>
spi_mosi = portI18<3><default><default><default>
spi_miso = portI19<3><default><default><default>

After changing this, the system boot, and sun7i_spi is able to identify the two devices.

[ 1548.823011] [spi-inf] Found 2 spi devices in config files
[ 1548.835507] [spi-inf] boards num modalias         max_spd_hz       bus_num  cs   mode
[ 1548.847390] [spi-inf] spi_board0 irq gpio not used
[ 1548.859316] [spi-inf] 0          spidev           12000000         0        0    0x3   
[ 1548.871343] [spi-inf] spi_board1 irq gpio not used
[ 1548.883260] [spi-inf] 1          spidev           12000000         0        1    0x3   

however, installing the modules, only the devices for spidev0 are created.
ll /dev/spi*
crw------- 1 root root 153, 0 Feb 18 14:15 /dev/spidev0.0
crw------- 1 root root 153, 1 Feb 18 14:15 /dev/spidev0.1

Modprobe gives a warning loading the modules:
modprobe -v spidev
modprobe: ERROR: magic check fail: 0 instead of b007f457
insmod /lib/modules/3.4.103/kernel/drivers/spi/spidev.ko

but the module is loaded anyway.

It seems that spidev_test works on both /dev/spidev0.0 and dev/spidev0.1, using the two different chip select, but I have no idea how to get /dev/spidev1

In case it could be useful to identify the problem, this is the output of udevadm monitor

modprobe -v spidev

KERNEL[113.441181] add      /module/spidev (module)
KERNEL[113.441384] add      /class/spidev (class)
KERNEL[113.441478] add      /bus/spi/drivers/spidev (drivers)
UDEV  [113.446276] add      /module/spidev (module)
UDEV  [113.448525] add      /class/spidev (class)
UDEV  [113.450156] add      /bus/spi/drivers/spidev (drivers)

modprobe -v spi-sun7i

KERNEL[188.718579] add      /module/spi_sun7i (module)
UDEV  [188.722839] add      /module/spi_sun7i (module)
KERNEL[188.791120] add      /devices/platform/sun7i-spi.0 (platform)
KERNEL[188.791278] add      /devices/platform/sun7i-spi.1 (platform)
UDEV  [188.804970] add      /devices/platform/sun7i-spi.0 (platform)
UDEV  [188.805121] add      /devices/platform/sun7i-spi.1 (platform)
KERNEL[188.838107] add      /devices/platform/sun7i-spi.0/spi_master/spi0 (spi_master)
UDEV  [188.850491] add      /devices/platform/sun7i-spi.0/spi_master/spi0 (spi_master)
KERNEL[188.850643] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.0 (spi)
UDEV  [188.850754] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.0 (spi)
KERNEL[188.850901] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.0/spidev/spidev0.0 (spidev)
UDEV  [188.851039] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.0/spidev/spidev0.0 (spidev)
KERNEL[188.851138] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.1 (spi)
UDEV  [188.851237] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.1 (spi)
KERNEL[188.854249] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.1/spidev/spidev0.1 (spidev)
UDEV  [188.855153] add      /devices/platform/sun7i-spi.0/spi_master/spi0/spi0.1/spidev/spidev0.1 (spidev)
KERNEL[188.946008] add      /devices/platform/sun7i-spi.1/spi_master/spi1 (spi_master)
UDEV  [188.947839] add      /devices/platform/sun7i-spi.1/spi_master/spi1 (spi_master)
KERNEL[188.998790] add      /bus/platform/drivers/sun7i-spi (drivers)
UDEV  [189.001016] add      /bus/platform/drivers/sun7i-spi (drivers)

here is the contents of

ls -l /sys/class/spidev/
lrwxrwxrwx 1 root root 0 Feb 18 16:50 spidev0.0 -> ../../devices/platform/sun7i-spi.0/spi_master/spi0/spi0.0/spidev/spidev0.0
lrwxrwxrwx 1 root root 0 Feb 18 16:50 spidev0.1 -> ../../devices/platform/sun7i-spi.0/spi_master/spi0/spi0.1/spidev/spidev0.1
l
s -l /sys/class/spidev/*/
/sys/class/spidev/spidev0.0/:
-r--r--r-- 1 root root 4096 Feb 18 16:51 dev
lrwxrwxrwx 1 root root    0 Feb 18 16:51 device -> ../../../spi0.0
drwxr-xr-x 2 root root    0 Feb 18 16:51 power
lrwxrwxrwx 1 root root    0 Feb 18 16:51 subsystem -> ../../../../../../../../class/spidev
-rw-r--r-- 1 root root 4096 Feb 18 16:42 uevent

/sys/class/spidev/spidev0.1/:
-r--r--r-- 1 root root 4096 Feb 18 16:51 dev
lrwxrwxrwx 1 root root    0 Feb 18 16:51 device -> ../../../spi0.1
drwxr-xr-x 2 root root    0 Feb 18 16:51 power
lrwxrwxrwx 1 root root    0 Feb 18 16:51 subsystem -> ../../../../../../../../class/spidev
-rw-r--r-- 1 root root 4096 Feb 18 16:42 uevent

any idea?







I was ready to trying the activate the second SPI on Pi this was actually the script that I got from this article. I have to know about the all parts on this that was on https://newyorkstreetfood.com/business-legal-police/how-to-start-a-food-blog-in-2019/ this was the main part of the file that was able to get the maon post on this.

You have to log in before you can reply Login | Sign Up

Points Rules