2020-12-16 12:33 AM
Hi,
Im working with STM32MP157A-DK1 board. Im working on the linux side, need to write C/C++ code for saving data into a SD card. I need to use SPI to get data from RF transceiver. I built linux and kernel as in this link:
Then i looked for articles on SPI, these ones especially :
https://wiki.st.com/stm32mpu/wiki/SPI_overview#Kernel_configuration
https://wiki.st.com/stm32mpu/wiki/How_to_use_SPI_from_Linux_userland_with_spidev#pnl-glhvfb87ri
https://wiki.st.com/stm32mpu/wiki/How_to_build_Linux_kernel_user_space_tools
https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package
And to be fair these are really good materials but i cant manage to be able to run spidev_test example.
i did rebuilt kernel , modules and tools ( also used make menuconfig and looked at SPI settings to make sure spi is enabled) , On the board i can see spi driver in this directory "/sys/bus/spi//drivers/" but the" devices/" directory is empty and can't see anything,
EDIT:
I did manage to activate SPI device i was editing the wrong .dts file, after editing stm32mp15x-dkxx.dtsi file i was able to see /spi0.0 device.
but i have another question now.
The GPIO pins for the MISO,MOSI and NSS how do i select them for SPI5 ?
2020-12-16 03:24 AM
I did manage to activate SPI device i was editing the wrong .dts file, after editing stm32mp15x-dkxx.dtsi file i was able to see /spi0.0 device.
but i have another question now.
The GPIO pins for the MISO,MOSI and NSS how do i select them for SPI5 ?
2020-12-16 04:13 AM
Hi @Mustafa Çerçi ,
Nice to read you are progressing.
FYI .dtsi file not supposed to be modify.
Proper WoW is to override the node property in your custom board dts.
Olivier
2020-12-16 05:08 AM
@Community member thank you also thank you for fast reply.
but i have a another question in the dtsi i wrote spi5 segment like this:
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_a>;
pinctrl-1 = <&spi5_sleep_pins_a>;
cs-gpios = <&gpioz 3 0>;
status = "okay";
/* USER CODE BEGIN spi5 */
spidev@0{
compatible = "spidev";
reg = <0>; /* CS #0 */
spi-max-frequency = <1800000>;
};
};
my question is the gpios. this line "cs-gpios = <&gpioz 3 0>;" appears wrong to me because in the example these are for spi4 i guess but i need to use spi5 in wiki i found this:
https://wiki.st.com/stm32mpu/wiki/STM32MP157x-DKx_-_hardware_description#GPIO_expansion_connector
which pins should write in to "cs-gpios = <&gpioz 3 0>;" this function can figure it out; my guess is "cs-gpios= <&gpiof 6 0>" but im not sure