STM32MP135x-DK spidev SPI5 troubleshooting
- December 16, 2023
- 1 reply
- 3308 views
Hello
I have an STM32MP135x-DK board and have built my own openstllinux image and rootfs for it as shown in this article.
https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package
Now I'm trying to get spi5 to show up in /dev so I can use spidev to write some user applications using spi5 as a generic spi master. The tl;dr is that I'm having issues even getting anything to show up in /sys/class/spi_master, much less /dev/spidev.
DETAILS:
I have followed the instructions here to configure the kernel and used a separate install of stm32cube IDE with the STM32MP135x-DK example project to generate my device tree with SPI5 enabled. Since then though, I have tried making a lot of hand-edits to my .dts file as I became more familiar with the syntax.
https://wiki.st.com/stm32mpu/wiki/SPI_overview
Here's what my .config file looks like in my kernel's build directory (with commented out options removed).
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_MEM=y
CONFIG_SPI_GPIO=m
CONFIG_SPI_STM32=m
CONFIG_SPI_STM32_QSPI=m
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_SLAVE=y
CONFIG_SPI_DYNAMIC=y
CONFIG_SPMI=y
CONFIG_PPS=y
Right now the options I need are specified as kernel modules, but I have tried compiling them into the kernel as well. I had no issues selecting these options using "bitbake -c menuconfig virtual/kernel" and am experienced and comfortable doing kernel development in yocto using bitbake or in "bitbake -c devshell linux-stm32mp"
Now for the device tree. I have made the edit to the device tree recommended in this article, but tweaked them to accomodate the pinout for spi5 of my dev board.
https://wiki.st.com/stm32mpu/wiki/SPI_device_tree_configuration#cite_note-DT_MP15_pinctrl-8
Here is the part in particular I have been looking at, but I have also uploaded the entire .dts file to this post.
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_a>;
pinctrl-1 = <&spi5_sleep_pins_a>;
status = "okay";
cs-gpios= <&gpioh 11 0>;
master@0 {
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <10000000>;
};
};
I have been able to rebuild the device tree in a devshell and have no issues scp'ing it over to my target board and rebooting with it. However, I just can't for the life of me get any spidev device to show up in /dev or even get an spi master to show up in /sys/class/spi_master
I also don't see spidev in the output of lsmod and no spi related messages have shown up in dmesg for any of my attempts.
I have used to md5sum utility to verify that the kernel images and dtb's I have compiled are the ones on target and am comfortable making tweaks to kernel config and device tree options but now don't know where else to look for debug information. This is my first foray into device tree development, so I'm wondering if there is something very amateurish that I have overlooked in all of this.
Thank you for any support that can be provided on this issue.
