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.

Unable to sense SPI0 output on L138 LCDK header pins

Other Parts Discussed in Thread: OMAPL138

Hi,

I am attempting to use the L138 as an SPI controller for an external device. I am looking to use the SPI0 peripheral's output pins. I am tweaking the SPI Example CSL project, which demonstrates the SPI0 in loopback mode. In the example projects original state, the SPI is in loopback mode (SPI_SPIGCR1_LOOPBACK = 1). When I disable loopback mode by setting SPI_SPIGCR1_LOOPBACK to 0, I expect to see output on the SPI0 pins. When I disable loopback mode, i notice that the loopback test fails (expected), but I still do not see any output on the SPI0 pins.

I found in the schematic that R214, R215, R216, R217 is not populated. I populated R214-217 with 0 Ohm resistors and removed R184, R179, R216, R217. I still do not see any output on the SPI0 pins (J15 pins 21, 23, 25, 27).

How do I modify the example code to output the SPI0 signals to the output pins? Please advise.

Best,

Miron

  • Dear Miron,
    Please make sure that you have done proper pinmuxing for SPI0 peripheral, you can verify through CCS memory/register window.

    If its internal loopback, you may not be able to get signals on SPI bus.
    So, please try to run default SPI1 code and check the signals on SPI1 bus for loopback mode.


    You can try to use the following starterware code.

    C:\ti\OMAPL138_StarterWare_1_10_04_01\examples\lcdkOMAPL138\spi

    I hope this helps.

  • Hi Titus,

    Thanks for the quick response. When you say "proper pinmuxing for SPI1 peripheral" can you explain more specifically what I need to bring attention to? Which registers are you refering to? I am working with SPI0, was it a typo when you wrote SPI1?

    I understood SPIPC0 to be responsible for multiplexing the pins?
    My current SPI0 SPIPC0 has
    SPI_SPIPC0_CLKFUN = 0x01
    SPI_SPIPC0_SOMIFUN = 0x01
    SPI_SPIPC0_SIMOFUN =0x01

    I understood SPIGCR1 to be responsible for loopback?
    My current SPI0 SPIGCR1 has
    SPI_SPIGCR1_ENABLE =0x01
    SPI_SPIGCR1_LOOPBACK =0x00

    I only configured registers corresponding to SPI0, I did not touch any registers corresponding to SPI1. Can you suggest how to proceed?
    Thanks!
    Miron
  • Dear Miron,
    You are right, that was type, now I edited.

    Please check the OMAPL138 TRM guide (technical reference manual)
    www.ti.com/.../spruh77a.pdf

    Refer to the chapter 11.5.10.4, PINMUX3 register.
    PINMUX register is used to select the peripheral (SPI0 CS, SIMO, SOMI, CLK) which we need to use since the same pin can be configurable multiple peripheral to avoid no of pins in the SoC.

    You can see this stuff in starterware code.

    /* Performing the Pin Multiplexing for SPI1. */
    SPIPinMuxSetup(1);

    You have to do the following for your requirement.
    /* Performing the Pin Multiplexing for SPI0. */
    SPIPinMuxSetup(0);

    C:\ti\OMAPL138_StarterWare_1_10_04_01\platform\lcdkOMAPL138\spi.c


    void SPIPinMuxSetup(unsigned int instanceNum)
    {
    unsigned int savePinMux = 0;

    if(0 == instanceNum)
    {
    /*
    ** Clearing the bits in context and retaining the other bit values
    ** of PINMUX3 register.
    */
    savePinMux = HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(3)) & \
    ~(SYSCFG_PINMUX3_PINMUX3_3_0 | \
    SYSCFG_PINMUX3_PINMUX3_15_12 | \
    SYSCFG_PINMUX3_PINMUX3_11_8 | \
    SYSCFG_PINMUX3_PINMUX3_7_4);

    /* Actual selection of SPI0 peripheral's pins for use. */
    HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(3)) = \
    (PINMUX3_SPI0_CLK_ENABLE | PINMUX3_SPI0_SIMO_ENABLE | \
    PINMUX3_SPI0_SOMI_ENABLE | PINMUX3_SPI0_ENA_ENABLE | \
    savePinMux);

    }
    else if(1 == instanceNum)
    {
    /*
    ** Clearing the bits in context and retaining the other bit values
    ** of PINMUX5 register.
    */
    savePinMux = HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(5)) & \
    ~(SYSCFG_PINMUX5_PINMUX5_11_8 | \
    SYSCFG_PINMUX5_PINMUX5_23_20 | \
    SYSCFG_PINMUX5_PINMUX5_19_16 | \
    SYSCFG_PINMUX5_PINMUX5_15_12);

    /* Actual selection of SPI1 peripheral's pins for use. */
    HWREG(SOC_SYSCFG_0_REGS + SYSCFG0_PINMUX(5)) = \
    (PINMUX5_SPI1_CLK_ENABLE | PINMUX5_SPI1_SIMO_ENABLE | \
    PINMUX5_SPI1_SOMI_ENABLE | PINMUX5_SPI1_ENA_ENABLE | \
    savePinMux);



    }
    else
    {


    }

    }

    So, please install starterware to understand better.

    processors.wiki.ti.com/.../StarterWare_SPI
  • This looks promising! I will give it a try first thing tomorrow and report my results. Thanks!
  • Hi Titus,

    Thank you for this post. I am using CSL in place of StarterWare, but I was able to accomplish the PINMUX thanks to the StarterWare code that you suggested that I review above. For future reference, I PINMUX'ed the SPI0 using CSL as follows:

    // CSL constants are used below defined in:
    //      C:\TI\pdk_OMAPL138_1_01_00_02\packages\ti\csl\cslr_syscfg0_C6748.h
    //      C:\TI\pdk_OMAPL138_1_01_00_02\packages\ti\csl\soc_C6748.h
    CSL_SyscfgRegsOvly syscfg0Regs=(CSL_SyscfgRegsOvly)CSL_SYSCFG_0_REGS;
    syscfg0Regs->PINMUX3 = CSL_FMK(SYSCFG_PINMUX3_PINMUX3_3_0, CSL_SYSCFG_PINMUX3_PINMUX3_3_0_SPI0_CLK)
    		      |CSL_FMK(SYSCFG_PINMUX3_PINMUX3_7_4, CSL_SYSCFG_PINMUX3_PINMUX3_7_4_NSPI0_ENA)
    		      |CSL_FMK(SYSCFG_PINMUX3_PINMUX3_11_8, CSL_SYSCFG_PINMUX3_PINMUX3_11_8_SPI0_SOMI0)
    		      |CSL_FMK(SYSCFG_PINMUX3_PINMUX3_15_12, CSL_SYSCFG_PINMUX3_PINMUX3_15_12_SPI0_SIMO0)
    		      |CSL_FMK(SYSCFG_PINMUX3_PINMUX3_23_20, CSL_SYSCFG_PINMUX3_PINMUX3_23_20_NSPI0_SCS4);

    Best,

    Miron