cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling /dev/spidevx.x on OpenSTLinux

MakerMelissa
Associate II

Hello,

I have an STM32MP157C-DK2 running OpenSTLinux using the STM32MP1Starter 2.0 image. I am wondering if it is possible to enable spidev drivers such that /dev/spidevx.x devices are available. I see that sys/bus/spi/devices exists, but there is nothing listed under it. I didn't see any spidev packages available using apt-cache search either.

Also, this may or may not be related, but i2c5, which according to https://www.st.com/resource/en/user_manual/dm00591354-discovery-kits-with-stm32mp157-mpus-stmicroelectronics.pdf is what is used on CN2 (the 40-pin header) is not appearing either.

Thanks

Melissa

1 ACCEPTED SOLUTION

Accepted Solutions
Fee
Senior

Hi,

for peripherals to be recognised in Linux you need to activate them in the device tree. For a start see here: https://wiki.st.com/stm32mpu/wiki/Device_tree

To specifically enable the spi you can look at this page: https://wiki.st.com/stm32mpu/wiki/SPI_device_tree_configuration

All other peripherals are listed here: https://wiki.st.com/stm32mpu/wiki/Category:Device_tree_configuration

To manually compile the device tree you will need the Linux kernel source code and the ST SDK. The device tree file you will want to configure is the stm32mp157c-dk2.dts file, which is the description for the dk2 development board. To compile the device tree take the following steps:

/* source the ST SDK before */
cd <linux source directory>
make stm32_defconfig
make stm32mp157c-dk2.dtb

You will end up getting the compiled device tree in the folder arch/arm/boot/dts/stm32mp157c-dk2.dtb.

Replacing the old device tree (you should find it in the /boot/ directory) on your board should enable the peripherals you activated after a reboot.

For using the spidev this might help you: https://stackoverflow.com/questions/53634892/linux-spidev-why-it-shouldnt-be-directly-in-devicetree

View solution in original post

2 REPLIES 2
Fee
Senior

Hi,

for peripherals to be recognised in Linux you need to activate them in the device tree. For a start see here: https://wiki.st.com/stm32mpu/wiki/Device_tree

To specifically enable the spi you can look at this page: https://wiki.st.com/stm32mpu/wiki/SPI_device_tree_configuration

All other peripherals are listed here: https://wiki.st.com/stm32mpu/wiki/Category:Device_tree_configuration

To manually compile the device tree you will need the Linux kernel source code and the ST SDK. The device tree file you will want to configure is the stm32mp157c-dk2.dts file, which is the description for the dk2 development board. To compile the device tree take the following steps:

/* source the ST SDK before */
cd <linux source directory>
make stm32_defconfig
make stm32mp157c-dk2.dtb

You will end up getting the compiled device tree in the folder arch/arm/boot/dts/stm32mp157c-dk2.dtb.

Replacing the old device tree (you should find it in the /boot/ directory) on your board should enable the peripherals you activated after a reboot.

For using the spidev this might help you: https://stackoverflow.com/questions/53634892/linux-spidev-why-it-shouldnt-be-directly-in-devicetree

Thanks, I was just hoping there was a simpler way.