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.

SPI config for AM5728

Other Parts Discussed in Thread: AM5728

Hello,

We are trying to configure SPI on a custom board on AM5728 core. We have similar design as that of BeagleBone-X15. We have made the below changes in the device tree to adapt SPI4.

************************************************************************

FILE NAME: am57xx-beagle-x15.dts

aliases {
rtc0 = &mcp_rtc;
rtc1 = &tps659038_rtc;
rtc2 = &rtc;
sound1 = &hdmi;
i2c5 = &i2c5;
spi4 = &mcspi4;
};

mcspi4_pins: pinmux_mcspi4_pins {
pinctrl-single,pins = <
0x3A4 (PIN_INPUT | MUX_MODE0) /* mcspi4_clk */
0x3AC (PIN_INPUT | MUX_MODE0) /* mcspi4_simo */
0x3A8 (PIN_INPUT | MUX_MODE0) /* mcspi4_somi */
0x3B0 (PIN_INPUT | MUX_MODE0) /* mcspi4_cs0 */
>;
};

&mcspi4 {
pinctrl-names = "default";
pinctrl-0 = <&mcspi4_pins>;
status = "okay";
};

************************************************************************

We have enabled the required SPI device driver in the kernel by

Device Drivers  --->
[*] SPI support
 [*] Mcspi Driver for Omap.

Is there anything to be done further? Please suggest.

Best Regards,

Srinidhi S.

 

  • I will forward this to the software team.
  • Hi,

    Check the following thread: e2e.ti.com/.../496527

    With the modifications described there, I've successfully enabled spi4 in am57xx beagle-x15.

    Best Regards,
    Yordan
  • Thanks for the reply. I see the following response to devmemcheck. Am not sure if this is correct.

    ./devmem2 0x4A009808
    /dev/mem opened.
    Memory mapped at address 0xb6f84000.
    Value at address 0x4A009808 (0xb6f84808): 0x30000

    And the spi_dev_test.c output yields:
    spi mode: 0x0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)
    RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................


    Best Regards,
    Srinidhi S.
  • Hi,

    Yes, output should be similar.
    Have you probed the spi pins with an oscilloscope to see if they are toggling?

    Best Regards,
    Yordan
  • Hello,
    There seems to be no toggling in the pins!
    My modified device tree is as below:

    *********************************************************
    aliases {
    spi4 = &mcspi4;
    };

    mcspi4_pins: mcspi4_pins {
    pinctrl-single,pins = <
    0x160 (PIN_INPUT_PULLUP | MUX_MODE8) /* mcspi4_clk */
    0x068 (PIN_INPUT_PULLUP | MUX_MODE8) /* mcspi4_miso */
    0x348 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* mcspi4_mosi */
    0x06C (PIN_OUTPUT_PULLUP | MUX_MODE8) /* mcspi4_cs0 */
    >;
    };

    &mcspi4 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&mcspi4_pins>;
    ti,pindir-d0-out-d1-in=<1>;
    spidev@4 {
    spi-max-frequency = <8000000>;
    reg = <0>;
    compatible = "rohm,dh2228fv";
    };
    };
    *********************************************************
    cat /sys/kernel/debug/pinctrl/4a003400.pinmux/pingroups
    group: mcspi4_pins
    pin 88 (4a003560.0)
    pin 26 (4a003468.0)
    pin 210 (4a003748.0)
    pin 27 (4a00346c.0)


    Best Regards,
    Srinidhi S.
  • Please respond to this thread.

    Best Regards,
    Srinidhi S.
  • Hi,

    I measured again on my am572x beagle x15, using the exact same modifications as in my previous post. Measured pins are:

     P17_ 37 -> spi4_clk

     P17_35 -> spi4_d1

     P17_6 -> spi4_cs0

    Here are the oscilloscope diagrams:

       

      

    I executed echo "DEADBEEF" > /dev/spidev1.0. 

    Have you checked in your sources that the muxed pins are NOT used by any other module? Have you enabled spidev driver (CONFIG_SPI_SPIDEV=y)? 

    Best Regards, 
    Yordan

  • My pins are not multiplexed anywhere. We have brought the pins directly from the core without any pullup/pulldown resistors anywhere.

    But still i don't see any activities! Am surprised.

    Best Regards,
    Srinidhi S.
  • Hi,

    "We have brought the pins directly from the core without any pullup/pulldown resistors anywhere. "

    I am a little confused here.. you need to do a proper pinmux settings from kernel space (not user spce) with pulls enabled, if you want your spi to work properly.

    Best Regards,
    Yordan
  • I mean, in our schematics, we have not connected any pullup/pulldown resistors to the pins.
    Ball G1 -> SPI4 clk;
    Ball AB9 -> d1;
    N9 -> d0;
    p9 -> CS0 are running directly to the connection headers.
    Will this cause any problem?

    Best Regards,
    Srinidhi S.
  • And also, CONFIG_SPI_SPIDEV=y
  • Hi, 

    Srinidhi S said:
    Will this cause any problem?

     

    No, It shouldn't cause problems.  Internal pulls should be enough, if you check am572x gp evm schematic, you can see that the pins I use, i.e. mmc_dat4 (muxed as spi4_clk) is connected directly to the expansion header P17_35.  

    Check your boot log, there may be some error messages, which indicate why your system does not accept the pinmux & spi settings?  

    Best Regards, 
    Yordan

  • Hi yordan,
    I have same problem with SPI in my custom board with AM5728 processor.
    /dev/spidev1.0 is available but while transferring data the clock is not showing in scope.
    my dts file is

    &mcspi1 {
    pinctrl-names = "default";
    pinctrl-0 = <&mcspi1_pins>;
    status = "okay";

    spidev@0{
    compatible = "rohm,dh2228fv";
    spi-max-frequency = <48000000>;
    reg = <0x0>;
    status = "okay";
    };

    };

    Thanks,
    PRRADDHEP REDDE
  • Have you enabled the spidev driver in menuconfig?
    Have you done the correct spi pinmuxing?

    Can you probe all the other spi pins: CS0, D0 and D1, to see if you have any activity on them? If yes, then you may have measured on the wrong pin.

    Best Regards,
    Yordan
  • Hi Yordan,

    In CCS i got CLK and CS0 in scope.

    But in Linux kernel my CS0 is high in scope and CLK is low.

    When i transfer data in /dev/spidev1.0 (Which is SPI4) even though CLK is always low.


    My PinMux in Linux for SPI4:

    ---------------------------------------

            mcspi4_pins: mcspi4_pins {
                    pinctrl-single,pins = <
                            0x160 (PIN_INPUT_PULLUP  | MANUAL_MODE | MUX_MODE8) /*vin2a_hsync0.spi4_clk*/
                            0x164 (PIN_INPUT_PULLUP  | MANUAL_MODE | MUX_MODE8) /*vin2a_vsync0.spi4_d1*/
                            0x168 (PIN_OUTPUT_PULLUP | MANUAL_MODE | MUX_MODE8) /*vin2a_d0.spi4_d0*/
                            0x350 (PIN_OUTPUT_PULLUP | MANUAL_MODE | MUX_MODE2) /*mcasp5_axr1.spi4_cs0*/
                    >;
            };

    &mcspi4 {
            pinctrl-names = "default";
            pinctrl-0 = <&mcspi4_pins>;
            status = "okay";

            spidev@0{
                      compatible = "rohm,dh2228fv";
                      spi-max-frequency = <48000000>;
                      reg = <0x0>;
                      status = "okay";
            };

    };

    My kernal config for SPI:

    ----------------------------------------

    CONFIG_SPI_SPIDEV=y

    CONFIG_SPI_OMAP24XX=y

    CONFIG_SPI=y
    CONFIG_SPI_DEBUG=y
    CONFIG_SPI_MASTER=y

    In U-boot:

    -------------------

    In u-boot when i press "sspi" command the system hanged.Can i enable any thing regarding SPI in u-boot

    Thanks,

    PRRADDHEP REDDE