2

I'm trying to do a spi loopback test with a raspberry pi 3 model B+ with kernel patched with RT_PREEMPT.

This is the loopback test being attempted: Link

To run the test you must specify a path such as /dev/spidev0.0. I have no such file in /dev:

pi@raspberrypi:~ $ ls /dev | grep spi
pi@raspberrypi:~ $ 

The kernel version:

pi@raspberrypi:~ $ uname -r
4.9.80-rt62-v7+

I think the settings in /boot/config.txt are what they are supposed to be and I've rebooted a few times since setting it this way:

pi@raspberrypi:/boot $ cat config.txt | grep spi
dtparam=spi=on

There seems to be all sorts of spi stuff in the loaded device tree:

pi@raspberrypi:~ $ dtc -I fs /proc/device-tree | grep 'spi'
<stdout>: Warning (unit_address_vs_reg): Node /soc has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /soc/vchiq has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /soc/gpiomem has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /soc/local_intc has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /soc/axiperf has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /memory has a reg or ranges property, but no unit name
<stdout>: Warning (unit_address_vs_reg): Node /axi/vc_mem has a reg or ranges property, but no unit name
<stdout>: Warning (avoid_default_addr_size): Relying on default #address-cells value for /axi/vc_mem
<stdout>: Warning (avoid_default_addr_size): Relying on default #size-cells value for /axi/vc_mem
        spi = "", "", "", "!status";
        spi2 = "/soc/spi@7e2150c0";
        spi0 = "/soc/spi@7e204000";
        spidev1 = "/soc/spi@7e204000/spidev@1";
        spi0_gpio35 = "/soc/gpio@7e200000/spi0_gpio35";
        spi = "/soc/spi@7e204000";
        spi0_pins = "/soc/gpio@7e200000/spi0_pins";
        spi0_gpio7 = "/soc/gpio@7e200000/spi0_gpio7";
        spi1 = "/soc/spi@7e215080";
        spi1_gpio16 = "/soc/gpio@7e200000/spi1_gpio16";
        spi2_gpio40 = "/soc/gpio@7e200000/spi2_gpio40";
        spi0_cs_pins = "/soc/gpio@7e200000/spi0_cs_pins";
        spidev0 = "/soc/spi@7e204000/spidev@0";
            spi0_gpio35 {
            spi0_pins {
            spi0_gpio7 {
            spi1_gpio16 {
            spi2_gpio40 {
            spi0_cs_pins {
        spi@7e204000 {
            compatible = "brcm,bcm2835-spi";
            spidev@1 {
                compatible = "spidev";
                spi-max-frequency = <0x7735940>;
            spidev@0 {
                compatible = "spidev";
                spi-max-frequency = <0x7735940>;
        spi@7e215080 {
            compatible = "brcm,bcm2835-aux-spi";
        spi@7e2150c0 {
            compatible = "brcm,bcm2835-aux-spi";
        spi2 = "/soc/spi@7e2150c0";
        spi0 = "/soc/spi@7e204000";
        spi1 = "/soc/spi@7e215080";

Any hints?

--Edit after some good hints in the comments --

I think I forgot to copy the /lib/modules/4.9.80-rt62-v7+/* files from the host where I built the kernel to the target.

adam@hostWhereKernelWasCrossCompiled:~/rtBuild_4_9$ find -iregex '.*spidev.*'
./lib/modules/4.9.80-rt62-v7+/kernel/drivers/spi/spidev.ko

pi@raspberrypi:/lib $ find -iregex '.*spidev.*'
./modules/4.14.34-v7+/kernel/drivers/spi/spidev.ko

No modules for 4.9.80-rt62-v7+ (the active kernel) are installed on the target.

11
  • look in the output of dmesg for references to SPI May 6, 2018 at 23:02
  • dmesg | grep -i 'spi' returns nothing
    – Adam
    May 6, 2018 at 23:09
  • how about lsmod | grep -i spi May 6, 2018 at 23:12
  • lsmod returns nothing at all. Even without piping it into grep.
    – Adam
    May 6, 2018 at 23:15
  • oh, well, that is odd - where did you get this kernel patched with RT_PREEMPT ... edit: never mind - found it May 6, 2018 at 23:18

1 Answer 1

2

/dev/spidev wasn't showing up because files were missing in /lib/modules.

I cross compiled the rt kernel and when I was installing it on the target I forgot to copy the /lib/modules/4.9.80-rt62-v7+ and /lib/firmware.

After copying the contents of those directories onto the taget and rebooting /dev/spidev exists!

pi@raspberrypi:~ $ ls /dev | grep spi
spidev0.0
spidev0.1
1
  • What do you mean when you say copy the files into "target" - what is target?
    – Legatro
    Feb 27, 2019 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.