Other Parts Discussed in Thread: TDA4VM
Tool/software:
Hi,
1.This SPI port is currently in use
How to configure SPI0_D0 for MIS0, SPI0_D1 for MOSI.
2. How to add and set the slave mode on dts
Regard,
Cesar
Tool/software:
Hi,
1.This SPI port is currently in use
How to configure SPI0_D0 for MIS0, SPI0_D1 for MOSI.
2. How to add and set the slave mode on dts
Regard,
Cesar
Hi Cesar,
Please reference this FAQ: [FAQ] J722SXH01EVM: How to enable McSPI on the 40 pin user expansion header for the J722SXH01EVM?
FAQ does not use Main SPI0, but it can be used as reference for what changes are needed to enable McSPI in general. As another reference, FAQ also has a link to application note that has more details and still relevant, but using TDA4VM.
Regards,
Takuma
Hi Takuma,
modify
@@ -3399,7 +3399,10 @@ CONFIG_SPI_OMAP24XX=m CONFIG_SPI_SPIDEV=m # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPI_SLAVE is not set +CONFIG_SPI_SLAVE=y +CONFIG_SPI_SLAVE_TIME=y +CONFIG_SPI_SLAVE_SYSTEM_CONTROL=y +CONFIG_SPI_DYNAMIC=y # CONFIG_SPMI is not set # CONFIG_HSI is not set
&main_pmx0 { main_spi0_pins_default: main-spi0-pins-default { pinctrl-single,pins = < J722S_IOPAD(0x01bc, PIN_INPUT, 0) /* (D20) SPI0_CLK */ J722S_IOPAD(0x01b4, PIN_INPUT, 0) /* (B20) SPI0_CS0 */ J722S_IOPAD(0x01c0, PIN_INPUT, 0) /* (E19) SPI0_D0 */ J722S_IOPAD(0x01c4, PIN_INPUT, 0) /* (E20) SPI0_D1 */ >; }; }; &main_spi0 { status = "okay"; #address-cells = <1>; #size-cells = <0>; pinctrl-0 = <&main_spi0_pins_default>; pinctrl-names = "default"; spi-slave; spidev@0 { /* * Using spidev compatible is warned loudly, * thus use another equivalent compatible id * from spidev. */ compatible = "rohm,dh2228fv"; spi-max-frequency = <24000000>; reg = <0>; }; };
1. the slave mode fail
2.
Is the direction set like this:
ti,pindir-d0-in-d1-out;
Regards,
Cesar
Hi Takuma,
thanks for the reminder, this configuration is OK;
but why is the value read from this register 0x20100124 equal to 0x0
Regard,
Cesar
Hi Cesar,
That looks like reset values. Can you run "ls -l /sys/class/spi*" and share logs?
If SPI is initialized correctly, you should see logs similar to the app note: https://www.ti.com/lit/an/sprad26/sprad26.pdf?ts=1756502475801&ref_url=https%253A%252F%252Fwww.google.com%252F
If SPI is not showing up, then please go through the app note, and/or FAQ previously shared to make sure all steps are followed, and make sure there are no errors being printed out related to SPI.
As a warning, one change in Linux kernel driver after the app note was made is that the spidev driver does not accept "spidev" as the compatible field in newer kernel versions. So, "rohm,dh2228fv" used in your current devicetree should be kept.
Regards,
Takuma
Hi Takuma,
root@j722s-evm:~# ls -l /sys/class/spi* /sys/class/spi_master: total 0 lrwxrwxrwx 1 root root 0 Jan 8 18:22 spi0 -> ../../devices/platform/bus@f0000/fc00000.bus/fc40000.spi/spi_master/spi0 /sys/class/spi_slave: total 0 lrwxrwxrwx 1 root root 0 Jan 8 18:23 spi1 -> ../../devices/platform/bus@f0000/20100000.spi/spi_slave/spi1 /sys/class/spidev: total 0 lrwxrwxrwx 1 root root 0 Jan 8 18:23 spidev1.0 -> ../../devices/platform/bus@f0000/20100000.spi/spi_slave/spi1/spi1.0/spidev/spidev1.0 root@j722s-evm:~# root@j722s-evm:~# devmem2 0x20100124 /dev/mem opened. Memory mapped at address 0xffff94e4a000. Read at address 0x20100124 (0xffff94e4a124): 0x00000000
Regard,
Cesar
Hi Cesar,
SPI looks to be enumerated.
As for the mcspi_syst register, I tried looking into our driver and TRM. Looks like driver does not program the "OMAP2_MCSPI_SYST" register. And direction is controlled by MCSPI_CHCONF registers which are written in the spi-omap2-mcspi.c driver.
In any case, does SPI communication work now that spi_slave and spidev are both registered?
Regards,
Takuma