No spidev on the Rpi3B?

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

No spidev on the Rpi3B?

Postby stramuort » Wed May 29, 2019 9:59 pm

Hi,

I am on the latest kernel (5.1.5-1-ARCH), have device_tree_param=spi=on in /boot/config.txt, and I am manually loading spi_bcm2835, spidev and spi_bcm2835aux but no signs of /dev/spidevX.X.

Is spi supported on the Raspberry Pi 3 / AARCH64?

Thanks!
stramuort
 
Posts: 8
Joined: Sat Oct 19, 2013 10:58 am

Re: No spidev on the Rpi3B?

Postby lategoodbye » Tue Jun 04, 2019 1:27 pm

Contrary to i2c-dev, spidev is a little more complicated because it requires a devicetree entry to enable the SPI and add an spi slave entry for the spidev.

Please follow this example which should enable spidev for the main SPI controller on RPI 3B+. You may need to adjust it to your needs:

$this->bbcode_second_pass_code('', '
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
index c6fa34c..0efb04e 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
@@ -176,3 +176,15 @@
pinctrl-0 = <&uart1_gpio14>;
status = "okay";
};
+
+&spi {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_gpio7>;
+ status = "okay";
+
+ spidev@0 {
+ compatible = "spidev";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ };
+};
')
lategoodbye
 
Posts: 116
Joined: Sat Dec 29, 2018 1:24 am

Re: No spidev on the Rpi3B?

Postby stramuort » Mon Jun 10, 2019 9:49 pm

Thank you very much!
Haven't tried using the spi interface yet, but your patch seems to work, /dev/spidev0.0 is there. However I get:

$this->bbcode_second_pass_code('', '
[ 3.346479] spi-bcm2835 3f204000.spi: no tx-dma configuration found - not using dma mode
[ 3.354033] spi spi0.0: setting up native-CS0 as GPIO 466
[ 3.361326] /soc/spi@7e204000/spidev@0: buggy DT: spidev listed directly in DT
[ 3.365009] WARNING: CPU: 0 PID: 1 at spidev_probe+0xf0/0x1c0
[ 3.368604] Modules linked in:
[ 3.372080] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.1.8-S #6
[ 3.375722] Hardware name: Raspberry Pi 3 Model B+ (DT)
[ 3.379357] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 3.383080] pc : spidev_probe+0xf0/0x1c0
[ 3.386765] lr : spidev_probe+0xf0/0x1c0
[ 3.390355] sp : ffff0000100237a0
[ 3.393884] x29: ffff0000100237a0 x28: 0000000000000000
[ 3.397370] x27: 0000000000000000 x26: 0000000000000000
[ 3.400695] x25: ffff000010c083f0 x24: ffff000010ca3110
[ 3.403924] x23: 0000000000000000 x22: ffff00001054eaf0
[ 3.407039] x21: ffff000010c083d0 x20: ffff800035abd000
[ 3.410065] x19: 0000000000000000 x18: 0000000000000010
[ 3.413024] x17: 0000000000000006 x16: 0000000000000008
[ 3.415809] x15: 0000000000000004 x14: 0000000000000001
[ 3.418420] x13: 0000000000000a40 x12: ffff00001095d160
[ 3.420870] x11: 0000000000000001 x10: 00000000ffffffff
[ 3.423231] x9 : 0000000000000001 x8 : ffff800035bead10
[ 3.425524] x7 : 000000000000006e x6 : 00000000ff000000
[ 3.427677] x5 : 0000000000aaaaaa x4 : 0000000000000000
[ 3.429674] x3 : 0000000000000000 x2 : 00000000ffffffff
[ 3.431579] x1 : 1f295db4b616c600 x0 : 0000000000000000
[ 3.433413] Call trace:
[ 3.435121] spidev_probe+0xf0/0x1c0
[ 3.436814] spi_drv_probe+0x7c/0xd8
[ 3.438456] really_probe+0xdc/0x498
[ 3.440159] driver_probe_device+0x54/0xe8
[ 3.441876] __device_attach_driver+0xdc/0x130
[ 3.443634] bus_for_each_drv+0x74/0xc0
[ 3.445428] device_initial_probe+0xe4/0x140
[ 3.447249] bus_probe_device+0xa4/0xb0
[ 3.449091] device_add+0x334/0x708
[ 3.450931] spi_add_device+0xac/0x170
[ 3.452768] of_register_spi_device+0x234/0x3c0
[ 3.454717] spi_register_controller+0x59c/0x770
[ 3.456755] devm_spi_register_controller+0x48/0x98
[ 3.458852] bcm2835_spi_probe+0x228/0x398
[ 3.460975] platform_drv_probe+0x50/0xa0
[ 3.463121] really_probe+0xdc/0x498
[ 3.465280] driver_probe_device+0x54/0xe8
[ 3.467494] __driver_attach+0x130/0x1b8
[ 3.469742] bus_for_each_dev+0x6c/0xc0
[ 3.471981] driver_attach+0x20/0x28
[ 3.474170] bus_add_driver+0x140/0x1e8
[ 3.476373] driver_register+0x74/0x120
[ 3.478579] __platform_driver_register+0x44/0x50
[ 3.480859] bcm2835_spi_driver_init+0x18/0x20
[ 3.483161] do_one_initcall+0x50/0x174
[ 3.485442] kernel_init_freeable+0x1c0/0x260
[ 3.487716] kernel_init+0x10/0xf8
[ 3.489928] ret_from_fork+0x10/0x1c
[ 3.492122] ---[ end trace 590e6c9a47abafb9 ]---

')
stramuort
 
Posts: 8
Joined: Sat Oct 19, 2013 10:58 am

Re: No spidev on the Rpi3B?

Postby lategoodbye » Tue Jun 11, 2019 7:01 pm

The warning shouldn't affect the function of SPI. In case you want DMA transfer, you need to apply this recent patch:
https://git.kernel.org/pub/scm/linux/ke ... 5742df4ba9
lategoodbye
 
Posts: 116
Joined: Sat Dec 29, 2018 1:24 am


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 4 guests