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 clock on AM335x EVM

I'm having difficulties getting the SPI clock signal to present on J3-13
(Expansion Connection - EXP2 of Daughter card, identified on Daughter card schematic)
of TI's AM335x EVM.

In the board-am335xevm.c , I have set the spi0_sclk as shown here...

static struct pinmux_config spi0_pin_mux[] = {
 {"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA}
,
......

};


and confirm that this is the actual struct that is actively involved with spi0 pins,
as I am able to change mode of spi0_d0 and spi0_cs0 to GPIO0[x] (MODE7)
 and see the expected effect on the scope at the expected pins.

While I have set spi0_d0 and spi0_cs0 set appropriately to MODE0,
I can cat /dev/urandom > /dev/spidev1.0 and see the data and select pins behaving properly.
I just don't get clock.

Is "spi0_sclk.spi0_sclk" getting set right to output the clock signal?
Is there something else in the processor clock system that needs to get redirected here?
I'd appreciate any suggestions.
Thanks,
Shannon

  • Hi,

    Can you take latest am335x release and try.

    pin-mux for spi0_clk is wrong here, you can find pin-mux details from here

    Thanks

    Avinash

  • Avinash,

    Thanks for your reply.  I dug into the latest source tree (dated: 2012-03-27) from the link that you sent to diff this file board_am335xevm.c against the one I am working with.  Only these lines were changed (in bold)

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

    static struct pinmux_config wl12xx_pin_mux_evm_rev1_1a[] = {
        {"gpmc_a0.gpio1_16", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
        {"mcasp0_ahclkr.gpio3_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
        {"mcasp0_ahclkx.gpio3_21", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
        {NULL, 0},
     };

    static struct pinmux_config wl12xx_pin_mux_evm_rev1_0[] = {
        {"gpmc_csn1.gpio1_30", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
        {"mcasp0_ahclkr.gpio3_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
        {"gpmc_csn2.gpio1_31", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT},
        {NULL, 0},
     };
    ---------------------------------------------------------------------------------------------------------------------------

    the latest file has no relevant changes for this issue. as you'll see...

  • ------------------------------------------------------------------------------------------------------------------------------------

    static struct pinmux_config spi0_pin_mux[] = {
        {"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_UP | AM33XX_PULL_ENBL},

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

    this was the change that seemed to make it work: AM33XX_PULL_UP | AM33XX_PULL_ENBL instead of AM33XX_PULL_DISA.

  • hi shannon,

    I meet the same trouble with you !

    I use the test procedure  spidev_test.c , short   d0 and d1 ,the communication  is normal!

    when the board communicate with DSP28335, the spiclk no output signal,  the clock signal clock is maintain high level.

    I  have  modified  spi0_pin_mux  to

    {"spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT | AM33XX_PULL_UP | AM33XX_PULL_ENBL},

     But there is still no clock signal!

    Did your spi can communicate?  Do you also have changed the other place about spi?

    Thanks!Looking forward to your help!


  • zerong,

    I'm using BeagleBONE now (much easier to access the spi pins, and cheaper), with the shipping A6 image from CircuitCo (the actual producers of the 'bone). Find the A6 image from this page with other useful info: http://circuitco.com/support/index.php?title=BeagleBone.  I tell you this because the A6 version has SPI configured by default, and brings it out to the filesystem at /dev/SPIDEV2.0.

    As is in this file:

    http://arago-project.org/git/projects/?p=linux-am33x.git;a=blob;f=arch/arm/mach-omap2/board-am335xevm.c;h=9fc88fba6702c169052a8e632d5b054345942460;hb=refs/heads/AM335XPSP_04.06.00.07

    successful spix_clk pinmux settings are like this:

    "spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL  | AM33XX_INPUT_EN},

    I don't know why it should be set as INPUT, but it works.

    I had problems, initially, using just a logic analyzer without an oscilloscope, and not seeing that there was some electrical circuit loading that suppressed the signal to much to register on logic analyzer.

    So, watch out for that.

    good luck.

  • Hi shannon,

    I am also using beaglebone now, my image is A5, my kernel is  'Linux-3.1.0-psp04.06.00.03. SDK'.

    Firstly,I  modify  the kernel file board-am335xevm.c like below:

    staticstructspi_board_info bone_spi0_info[] = {
    {
    .modalias = "spidev",
    .max_speed_hz = 48000000, //48 Mbps
    .bus_num = 1,
    .chip_select = 0,
    .mode = SPI_MODE_0,
    },
    };

    and

    static void spi0_init(intevm_id, int profile)
    {
    setup_pin_mux(spi0_pin_mux);
    spi_register_board_info(bone_spi0_info,
    ARRAY_SIZE(bone_spi0_info));
    return;
    }

     Add the following to the beaglebone_dev_cfg[] struct:

    {spi0_init, DEV_ON_BASEBOARD, PROFILE_NONE},

    Next , I can find spidev like below :


    root@am335x-evm:/# find -name 'spidev*'  
    ./dev/spidev2.0
    ./dev/spidev1.0
    ./dev/.udev/names/spidev2.0
    ./dev/.udev/names/spidev1.0
    ./opt/spidev_test
    ./mnt/spidev_test
    ./mnt/spidev_fdx
    ./media/mmcblk0p2/opt/spidev_test
    ./media/mmcblk0p2/mnt/spidev_test
    ./media/mmcblk0p2/mnt/spidev_fdx
    ./media/mmcblk0p2/sys/spidev_test
    ./sys/devices/platform/omap/omap2_mcspi.1/spi1.0/spidev
    ./sys/devices/platform/omap/omap2_mcspi.1/spi1.0/spidev/spidev1.0
    ./sys/devices/platform/omap/omap2_mcspi.2/spi2.0/spidev
    ./sys/devices/platform/omap/omap2_mcspi.2/spi2.0/spidev/spidev2.0
    ./sys/bus/spi/drivers/spidev
    ./sys/class/spidev
    ./sys/class/spidev/spidev1.0
    ./sys/class/spidev/spidev2.0
    ./sys/module/spidev
    root@am335x-evm:/#

    Then , connect pins 18 and 21 together on the P9 header.

    root@am335x-evm:/mnt# ./spidev_test -D /dev/spidev2.0

    spi mode: 0

    bits per word: 8

    max speed: 500000 Hz (500 KHz)

    FF FFFFFFFFFF

    40 00 00 00 00 95

    FF FFFFFFFFFF

    FF FFFFFFFFFF

    FF FFFFFFFFFF

    DE AD BE EF BA AD

    F0 0D

    Finally, I connect beaglebone and DSP28335 together ,use the spidev_fdx.c   test,

    root@am335x-evm:/mnt# ./spidev_fdx -m 3 /dev/spidev1.0

    /dev/spidev1.0: spi mode 0, 8 bits per word, 48000000 Hz max

    read(3, 3): 00 00 00

    spix_clk pinmux settings are like this:

    "spi0_sclk.spi0_sclk", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL  | AM33XX_INPUT_EN},

    but ,I can't find spiclk signal in the pin,why?

    I use an oscilloscope, spiclk signal is still high, I can't find the reason,help me ?

    There are still some details need to pay attention to?


    thank you !