Emlid

Community Forum

RCIO fails to load


(Tanmaya Mishra) #1

Hi! I am using a custom kernel (I need OP-TEE and RT patches on a Raspberry Pi 3 model B). Kernel version is 4.6.3 I am trying to use the Navio2 board and have managed to get most of the drivers working. However, the rcio driver fails to load correctly and does not generate any node in /sys/kernel/.

This is what I have:

  1. I don’t have overlay support, since I am using u-boot and have failed to figure out how to enable the feature in it. I, thus, resort to manually applying the relevant overlays to the base dts file and compiling it to create the dtb file which is loaded.

  2. My device tree file’s SPI1 section is so:

    spi1_pins { brcm,pins = <0x13 0x14 0x15>; brcm,function = <0x3>; linux,phandle = <0x41>; phandle = <0x41>; };
     	spi1_cs_pins {
     		brcm,pins = <0x10>;
     		brcm,function = <0x1>;
     		linux,phandle = <0x42>;
     		phandle = <0x42>;
     	};
    
    spi@7e215080 { compatible = "brcm,bcm2835-aux-spi"; reg = <0x7e215080 0x40 0x7e215000 0x8>; interrupts = <0x1 0x1d>; clocks = <0x8 0x1>; pinctrl-names = "default"; pinctrl-0 = <0x41 0x42>; cs-gpios = <0xc 0x10 0x1>; #address-cells = <0x1>; #size-cells = <0x0>; status = "okay"; spidev@0 { compatible = "spidev"; reg = <0x0>; #address-cells = <0x1>; #size-cells = <0x0>; spi-max-frequency = <0x7a120>; status = "disabled"; }; rcio@0 { compatible = "rcio"; spi-max-frequency = <0x3d0900>; reg = <0x0>; status = "okay"; }; };
  3. If I compile this to dtb and boot the Pi, load the dmesg output is:

    $ dmesg | grep rcio
    [ 4.863320] rcio: probe of spi1.0 failed with error -16

  4. If I change the spidev@0 status to enabled, there is no rcio in the kernel log and I get:

    $ dmesg | grep spi
    [ 1.951346] spi-bcm2835aux 3f215080.spi: chipselect 0 already in use
    [ 1.957826] spi_master spi1: spi_device register error /soc/spi@7e215080/rcio@0
    [ 1.965261] spi_master spi1: Failed to create SPI device for /soc/spi@7e215080/rcio@0

I am stuck as to what to do. spi0.0 - spi0.3 get created and the LMS9DS1 sensors works perfectly fine, however RCIO which uses the SPI1 interface fails to work. Any ideas how I can fix this?


Kernel/rcio/status/crc does not exist
(George Staroselskiy) #2

I did manage to boot Linux with Device Tree support using u-boot in the past. I suggest looking into u-boot master or Yocto’s u-boot. AFAIK, the dtb address may be passed through a register and then read by u-boot to load dtb and kernel from the appropriate address (rather than hardcoded in /boot/config.txt). I suggest try to boot a kernel with DTB with U-Boot and then just load our rcio.dtbo. This is not so hard to do! This has been done by Mender.io guys using raspberrypi-meta (which might include the needed U-Boot version by now. At the time I was poking around I needed to apply a couple of patches myself) a while back. You have done a pretty awesome job by putting all of the pieces together up until now. So I guess with these tips you’ll get the results you’re craving in no time.

sudo vcdbg log msg output is also useful while debugging these low-level details.

If that doesn’t work out for you we may think of other solution. Keep up the good work, then.


(Tanmaya Mishra) #3

Thank you! I just needed someplace to look to figure out how to fix this. I’ll try loading the overlay as you suggested and get back to you in case it doesn’t work.

Thanks again


(Tanmaya Mishra) #4

Turns out it was a problem in how the rcio driver checks SPI and PWM interfaces. The error code -16 was being thrown because of multiple checks and was completely unrelated to SPI. In case anyone has a similar problem, check whether you have a pwmchip0 already created under /sys/class/pwm. Essentially, the driver expects that pwmchip0 will not exist and fails while initializing it (since it already exists). This causes the RCIO SPI interface initialization to fail. Simply disable pwm in your device tree (I’ll try creating a patch to generate a error/warning to tell the user to do this). This will prevent the pwmchip0 interface to be created automatically, allow the driver to generate it and rcio will appear under /sys/kernel.

Hope that helps!


(George Staroselskiy) closed #5