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.

TDA4VM: TDA4 SPI config in DTS

Part Number: TDA4VM


Tool/software:

Hi,

  I need to configure SPI5 in the Linux device tree. Currently, I am using the configuration shown in the figure below. I would like to know if SPI5 pins still need to be configured in path pdk_jacinto_10_00_00_27/packages/ti/board/src/j721e_evm/J721E_pinmux_data.c?

  Besides, I used CS1 in SPI5, should the parameter 'reg=<0>' be modified to 'reg=<1>'? What does this parameter mean?

Regards,

Yang

  • Hi Yang,

    No, SPI5 pins do not have to be configured within PDK. They need to be only configured within Linux devicetree if the SPI interface is planned to be used from Linux, or only within PDK if the SPI interface is planned to be used from RTOS, but not both at the same time to avoid resource conflict.

      Besides, I used CS1 in SPI5, should the parameter 'reg=<0>' be modified to 'reg=<1>'?

    This is the register property, and in this particular case it is indicating that the spidev device is located at an offset of 0 within the parent bus, main_spi5.

    Please feel free to ask more questions if you are trying out the Linux spidev example and are finding that spi is not working. Full logs from "dmesg" will be helpful to identify current situation being observed.

    Regards,

    Takuma

  • Hi,

    I want to export GPO0_40 under/dev/gpiochip0, but after configuring it according to the above content, I found that there is no such node. Can you tell me how to configure it?

    main_spi3_pins_default: main-spi3-default-pins {
    pinctrl-single,pins = <
    J721E_IOPAD(0x144, PIN_INPUT, 4) /* (Y25) PRG0_PRU1_GPO17.SPI3_CLK */
    J721E_IOPAD(0x11c, PIN_INPUT, 4) /* (AA24) PRG0_PRU1_GPO7.SPI3_CS0 */
    J721E_IOPAD(0xd4, PIN_INPUT, 4) /* (AB26) PRG0_PRU0_GPO9.SPI3_CS1 */
    J721E_IOPAD(0xd8, PIN_INPUT, 4) /* (AB25) PRG0_PRU0_GPO10.SPI3_CS2 */
    J721E_IOPAD(0x124, PIN_INPUT, 4) /* (Y24) PRG0_PRU1_GPO9.SPI3_CS3 */
    J721E_IOPAD(0x148, PIN_INPUT, 4) /* (AA26) PRG0_PRU1_GPO18.SPI3_D0 */
    J721E_IOPAD(0x14c, PIN_INPUT, 4) /* (AA29) PRG0_PRU1_GPO19.SPI3_D1 */
    J721E_IOPAD(0xa4, PIN_INPUT, 7) /* (AH22) PRG1_PRU1_GPO19.GPIO0_40 */
    >;
    };

    &main_spi3 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&main_spi3_pins_default>;
    gpios = <&main_gpio0 40 GPIO_ACTIVE_HIGH>;

    spidev@0 {
    compatible = "ti,spi-evm";
    spi-max-frequency = <3125000>;
    reg = <0>;
    spi-cpol = <1>; // CPOL = 1
    spi-cpha = <1>; // CPHA = 1
    };
    spidev@1 {
    compatible = "ti,spi-evm";
    spi-max-frequency = <3125000>;
    reg = <1>;
    spi-cpol = <0>; // CPOL = 0
    spi-cpha = <1>; // CPHA = 1
    };
    spidev@2 {
    compatible = "ti,spi-evm";
    spi-max-frequency = <3125000>;
    reg = <2>;
    spi-cpol = <0>; // CPOL = 0
    spi-cpha = <0>; // CPHA = 0
    // interrupts = <GIC_SPI 90 IRQ_TYPE_EDGE_RISING>;
    };
    spidev@3 {
    compatible = "ti,spi-evm";
    spi-max-frequency = <3125000>;
    reg = <3>;
    spi-cpol = <0>; // CPOL = 0
    spi-cpha = <1>; // CPHA = 1
    };
    };

    Regards,

    Yang

  • Hi Yang,

    I am a bit confused what the issue and goal is for this thread. Can you clarify whether the issue is either:

    1. Is this an issue with McSPI/spidev, and the goal is to send SPI data
    2. Or, is the issue with setting up a generic GPIO pin and the goal is to toggle this GPIO pin

    Since the latest question is about GPIO, I assume the goal is to set up a generic GPIO for toggling manually. If yes, then the sysfs portion is outdated as sysfs was replaced with chardev, but this FAQ has some instructions for devicetree: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/918654/faq-tda4vm-dra829-am65xx-linux-configuring-gpios 

    And for more information about the new chardev and GPIO tools, this FAQ would be good to read: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1260373/faq-transitioning-the-gpio-userspace-interface-from-sysfs-to-chardev 

    Regards,

    Takuma 

  • Hi,

      Thank you very much for your answer. As there is an external input to the GPIO of TDA4, I need to read the GPIO status during SPI communication in Linux to determine when to start sending.

    Reagrds,

    Yang

  • Hi Yang,

    Understood. If there are follow up questions please feel free to post or open up a new thread.

    Regards,

    Takuma