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.

SPI0 problem

Other Parts Discussed in Thread: OMAPL138, OMAP-L138

Hi,

I am using OMAPL138 processor.

I configured SPI1 using starterware library, It works prefect. But  When I try to use SPI0 with the same configration, It doesn't work. the output of SPI0 is false & the clock signal doesn't match the clock of SPI1.

Best Regards,
Ahmed Zaki 

  • Which SPI example are you using? Which platform EVM or LCDK? I vaguely remember that there 3 or 4 places where there are hard-coded values for SPI1.

  • Additionally, can you also make sure that you are "retuning" the clock for SPI0. SPI0 vs SPI1 have a difference in how they are clocked in the device.

    Perhaps this post helps

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/67264.aspx

    To Norman's point, I think on LCDK SPI0 is mux'd with other functions on the board, so to use it reliably , you might need some board mods and proper pinmuxing settings.

    Regards

    Mukul

  • Sorry for being late.

    Thanks for fast response.

    I’m using Omapl138 EVM board, Code composer V5.3 and OMAPL138 Starter Ware V1_10_03_03.

    Here is my configuration For SPI 1 :

    /**********************************  Start Of Code *********************************************/

    Void main()

    {

           /** Walking UP SPI instance 1 **/

          PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_SPI1,PSC_POWERDOMAIN_ALWAYS_ON,PSC_MDCTL_NEXT_ENABLE);

         /** Config. Pin Mux for SPI1 **/

       SPIPinMuxSetup(1);

       SetUpSPI();

        BIOS_start();

    }

    /** SetUP SPI1 **/

    void SetUpSPI()

    {

     

        unsigned int  val = 0x00000E00;

     

        SPIReset(SOC_SPI_1_REGS);

     

        SPIOutOfReset(SOC_SPI_1_REGS);

     

        SPIModeConfigure(SOC_SPI_1_REGS, SPI_MASTER_MODE);

     

        SPIClkConfigure(SOC_SPI_1_REGS, 150000000, 25000000, SPI_DATA_FORMAT0); // **

     

        SPIPinControl(SOC_SPI_1_REGS, 0, 0, &val);

     

        SPIConfigDataFmtReg();

         /* map interrupts to interrupt line INT1 */

        SPIIntLevelSet(SOC_SPI_1_REGS, SPI_RECV_INTLVL | SPI_TRANSMIT_INTLVL);

        /* Enable SPI communication */

        SPIEnable(SOC_SPI_1_REGS);

    }

     

    void SPIConfigDataFmtReg()

    {

            /* Configures the polarity and phase of SPI clock */

    SPIConfigClkFormat(SOC_SPI_1_REGS,(SPI_CLK_POL_LOW | SPI_CLK_OUTOFPHASE),SPI_DATA_FORMAT0);

     

        /* Configures SPI to transmit MSB bit First during data transfer */

     

        SPIShiftLsbFirst(SOC_SPI_1_REGS, SPI_DATA_FORMAT0);

     

        /* Sets the Charcter length */

        SPICharLengthSet(SOC_SPI_1_REGS, 0x10, SPI_DATA_FORMAT0);

    }

     

    void SPI_Task()

    {

           Unsigned int TX_data = 10;

           Unsigned int RX_data = 0;

          SPIIntEnable(SOC_SPI_1_REGS, (SPI_RECV_INT));

           While(1)

    {

           Semaphore_pend(SPI_SEM,BIOS_WAIT_FOREVER);

           SPITransmitData1(SOC_SPI_1_REGS, TX_data);

          SPIInterruptVectorGet(SOC_SPI_1_REGS);

        RX_data = SPIDataReceive(SOC_SPI_1_REGS);

        TX_data ++;

    }

          

    }

     

    Void SPI_ISR()

    {

         Semaphore_post(SPI_SEM);

    }

    /**********************************  End Of Code *********************************************/

    The above code works perfect with no errors and SPI Clock Frequency is 25 MHZ (as configured in the code above **).

    when i try to use the same example with configuration of SPI0 the clock frequency is not 25 MHZ and Duty cycle Is variable (not 50%).

    The Configuration of SPI0 is done by replacing the following :

    1-     PSCModuleControl(SOC_PSC_0_REGS, HW_PSC_SPI0,PSC_POWERDOMAIN_ALWAYS_ON,PSC_MDCTL_NEXT_ENABLE);

    2-      SPIPinMuxSetup(0);

    3-      replacing all "SOC_SPI_1_REGS" with "SOC_SPI_0_REGS"

    4-     Besides changing Event ID form "43"  to "37"

    so is there error in my configuration could cause this problem?

    Thanks in advance.

  • The change you made for SPI1 to SPI0 are the same one I made for the C6747. The only missing bit is the SPI CS config. Rare to see StarterWare mixed in with BIOS. Usually see BIOPSP SPI driver used with BIOS.

    The C6747 has one PLL clock source for both SPIs. The OMAP-L138 has PLL0 for SPI0 and PLL1 for SPI1. PLL0 drives a lot of other important stuff (eg. ARM, DSP). Seems unlikely PLL0 is configured bad. No experience messing with the PLL. Sorry, that's all I got.

  • hi,

    do you already found for solution of this issue?
    i'm using LCDK6748 also facing the same issue..
    SPI0 cannot work as SPI1 using starterware..
    is starterware only support SPI1 ?
  • Hi Frank,

    Are you working with custom board ?
    As C6748LCDK SPI0 lines are hard-wired for LAN8710A-EZK.
  • hi arvind,

    currently im working with dev kit LCDK C6748.. i will make my custom board after i finished testing using dev kit..

    is it possible to use it as SPI since i didn't use the LAN?

    thank you

  • Hello Franz,

    Please follow up in below thread that was created by you.

    e2e.ti.com/.../452507

    Regards,
    Senthil