This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TDA4VM: TDA4 SPI slave DMA configuration and interface function

Part Number: TDA4VM

Tool/software: TI C/C++ Compiler

Hi ALL

Now our requirement is to use MCSPI0 as the slave mode to communicate with the MCU.
1. My configuration in dts is as follows:
main_spi0: spi@2100000 {
compatible = "ti,am654-mcspi","ti,omap4-mcspi";
reg = <0x0 0x2100000 0x0 0x400>;
interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&k3_clks 137 1>;
power-domains = <&k3_pds 137 TI_SCI_PD_EXCLUSIVE>;
#address-cells = <0>;
#size-cells = <0>;
dmas = <&main_udmap 0xc500>, <&main_udmap 0x4500>;
dma-names = "tx0", "rx0";
spi-slave;
};

&main_spi0 {
pinctrl-names = "default";
pinctrl-0 = <&main_spi0_pins_default>;
// ti,pindir-d0-out-d1-in = <1>;

slave{
spi-slave;
compatible = "tda4,spi0";
// reg = <0x0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <1>;
spi-max-frequency = <5000000>;
spi-cpha;
};
};

main_spi0_pins_default: main-spi0-pins-default {
pinctrl-single,pins = <
J721E_IOPAD(0x1c0, PIN_INPUT_PULLUP, 0) /* (AA2) SPI0_CS0 */
J721E_IOPAD(0x1c8, PIN_INPUT_PULLDOWN, 0) /* (AA1) SPI0_CLK */
J721E_IOPAD(0x1cc, PIN_INPUT_PULLUP, 0) /* (AB5) SPI0_D0 */
J721E_IOPAD(0x1d0, PIN_OUTPUT, 0) /* (AA3) SPI0_D1 */
>;
};
Please help to confirm if there is a problem with this dts configuration if you need to use slave mode.
The part marked in red. What is the interrupt number? Because I see this is the configuration in the SDK, but Page 6413 of the TRM document, MCSPI0_INTR_SPI_0 is 216. So I would like to ask how much the interrupt number should be configured?

2. Does MCSPI0 have a demo code as a slave mode?
  • Now our requirement is set MCSPI0 to slave mode and communication with another IC

    1.my configuration in dts:

    main_spi0: spi@2100000 {
    compatible = "ti,am654-mcspi","ti,omap4-mcspi";
    reg = <0x0 0x2100000 0x0 0x400>;
    interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&k3_clks 137 1>;
    power-domains = <&k3_pds 137 TI_SCI_PD_EXCLUSIVE>;
    #address-cells = <0>;
    #size-cells = <0>;
    dmas = <&main_udmap 0xc500>, <&main_udmap 0x4500>;
    dma-names = "tx0", "rx0";
    spi-slave;
    };

    &main_spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&main_spi0_pins_default>;
    // ti,pindir-d0-out-d1-in = <1>;

    slave{
    spi-slave;
    compatible = "tda4,spi0";
    // reg = <0x0>;
    spi-tx-bus-width = <1>;
    spi-rx-bus-width = <1>;
    spi-max-frequency = <5000000>;
    spi-cpha;
    };
    };

    main_spi0_pins_default: main-spi0-pins-default {
    pinctrl-single,pins = <
    J721E_IOPAD(0x1c0, PIN_INPUT_PULLUP, 0) /* (AA2) SPI0_CS0 */
    J721E_IOPAD(0x1c8, PIN_INPUT_PULLDOWN, 0) /* (AA1) SPI0_CLK */
    J721E_IOPAD(0x1cc, PIN_INPUT_PULLUP, 0) /* (AB5) SPI0_D0 */
    J721E_IOPAD(0x1d0, PIN_OUTPUT, 0) /* (AA3) SPI0_D1 */
    >;
    };

    pls help us to confirm if we need use SPI slave mode ,above dts is correct or not?

    2.“ interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;”

    what is the irq number,of above sentence,is 184,correct?Since I found the 184 is from SDK, but it is 216 from TRM spec. Page 6413.

    3. Is there any Demo code for "MCSPI0 as Slave mode"

  • Hi,

    There is NO support for SPI slave mode on TDA4. Only master mode is supported on the SDK.

    Master mode support steps are captured in the e2e thread: e2e.ti.com/.../947437

    Best Regards,
    Keerthy

  • HI:

    Can you help confirm whether the above configuration is correct0
    about SPI slave mode
  • Is the chip not supporting SPI slave mode? or there is no slave mode in the SDK

  • Hi,

    There is no support in the SDK.

    Some patches upstream: patchwork.kernel.org/.../

    Please resolve the issue if no further questions.

    Best Regards,
    Keerthy

  • Hi

    The Slave mode use DMA in SDK,but it always block when reading data in DMA handle

    Do you have SPI slave demo project without DMA

  • Hi Haitao,

    Unfortunately we have no slave demo project without DMA.

    Best Regards,
    Keerthy