cancel
Showing results for 
Search instead for 
Did you mean: 

SPI HW testing (STM32MP157CAA)

VivekB
Associate II

Hi there, 

I have started looking into writing a test program/script to test the functionality of the one of the SPI bus interface (which in the current board called SPI6). Now when I looked into the kernel (the below is the STM kernel we are using at the moment):

# uname -a 
Linux buildroot 5.15.67 #1 SMP PREEMPT Tue Feb 6 16:12:01 GMT 2024 armv7l GNU/Linux

I can see the following: 

# ls -la /sys/bus/spi/devices/spi0.
spi0.0/ spi0.1/ spi0.2/ spi0.3/ spi0.4/

# ls -la /sys/class/spi_master/spi
spi0/ spi1/

# ls -la /sys/class/spi_
spi_master/ spi_slave/

# ls -la /sys/class/spi_master/
total 0
drwxr-xr-x 2 root root 0 Feb 7 08:18 .
drwxr-xr-x 58 root root 0 Feb 7 08:18 ..
lrwxrwxrwx 1 root root 0 Feb 7 10:01 spi0 -> ../../devices/platform/soc/44004000.spi/spi_master/spi0
lrwxrwxrwx 1 root root 0 Feb 7 10:01 spi1 -> ../../devices/platform/soc/5c001000.spi/spi_master/spi1

# ls -la /sys/class/spi_slave/
total 0
drwxr-xr-x 2 root root 0 Feb 7 08:18 .
drwxr-xr-x 58 root root 0 Feb 7 08:18 ..

I checked the .config file we are using and the below config options are present: 

CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_STM32=m
CONFIG_SPI_STM32_QSPI=y
CONFIG_SPI_SPIDEV=y
CONFIG_SPI_MASTER=y

I can also see the below module:

# lsmod | grep -i spi
spi_stm32 24576 0

However, I was expecting to see spi nodes under /dev which I cannot:

# ls -la /dev/spi*
ls: /dev/spi*: No such file or directory

I do not have any slave device attached to the bus yet. Can someone please suggest if there is anything I am missing here? Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Erwan, 

 

Thanks for the reply. I have thankfully resolved the issue with the help from SO. Here is the link if someone is interested in future:

https://stackoverflow.com/questions/77953893/spi-hw-testing-stm32mp157caa?noredirect=1#comment137444496_77953893

 

View solution in original post

2 REPLIES 2
Erwan SZYMANSKI
ST Employee

Hello @VivekB ,
What does your device trees' SPI node looks like ? Do you have spi subnodes defined ? 
If you want to make some basic tests, you need to at least declare some spidev subnodes.

Please see an example here in the wiki: https://wiki.st.com/stm32mpu/wiki/How_to_use_SPI_from_Linux_userland_with_spidev#DT_and_kernel_configuration

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi Erwan, 

 

Thanks for the reply. I have thankfully resolved the issue with the help from SO. Here is the link if someone is interested in future:

https://stackoverflow.com/questions/77953893/spi-hw-testing-stm32mp157caa?noredirect=1#comment137444496_77953893