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.

TMS320F28335: SPI provision to out contineous clock on SPICLK pin without sending data on SPIMOSI

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Hi,

I want to send continuous clock on the SPICLK pin without sending data from master on SPIMOSI pin.

Is there any provision to do same by any SFR setting?

Thanks & Regards,

Sachin

  • Hello Sachin,

    There is no provision to send a continuous clock on the SPICLK pin without sending data from master on SPIMOSI pin through an SFR setting. To do this just enable the clock of the peripheral, and do not write data to the SPIDAT or SPITXBUF registers until you would like to transfer data.

    Best Regards,

    Marlyn

  • Hi,

    Thanks for your input.

    How to enable peripheral clock?

    Thanks & Regards,

    Sachin

  • To enable the SPI CLK change the SPIAENCLK bit in the PCLKCR0 register (Peripheral clock control register). For example, 'SysCtrlRegs.PCLKCR0.bit.SPIAENCLK = 1;". This is an EALLOW protected write. 

    If you look at the examples in C2000WARE this is typically found within the InitSysCtrl() function and then within the InitPeripheralClocks() function.

    Best,

    Marlyn

  • Hi,

    Thanks for this input.

    In my SPI application Slave inform to Master when there is data by GPIO. I have configured this GPIO as a external Interrupt.So when there is data external interrupt occures.I set notification flag and tried to send 0x00 on MOSI pin to give clock to SPI.

    Please find below code 

    a.Continuous for Loop

        for(;;)
        {

           // SpiaRegs.SPITXBUF = 0x00;
         // if(flag == 1)for(i=0;i<15;i++)SpiaRegs.SPITXBUF = 0;

           // while(Xint1Count<2)SpiaRegs.SPITXBUF = 0;
          //  while(notification==1)SpiaRegs.SPITXBUF = 0;

         if(notification==1)
         {
            for(i=0;i<15;i++)SpiaRegs.SPITXBUF = 0;
            display =1;
         }
        if(display ==1)
         {
             for(i=0;i<10;i++)scia_xmit(rdata[i]);
             display = 0;
             scia_xmit(Xint1Count);
         }
        }

    b.External Interrupt

    __interrupt void
    xint1_isr(void)
    {
        //GpioDataRegs.GPBCLEAR.all = 0x4;   // GPIO34 is low
        Xint1Count++;


        if(Xint1Count == 1)
        {
            notification=1;
        }
        else if (Xint1Count == 2)
            {
            notification=0;
            display = 1;
            }
        //
        // Acknowledge this interrupt to get more from group 1
        //
        PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    C.Capturing data in SPIFIFORX ISR,interrupt occurs when there is one character at SPI receive FIFO

    __interrupt void
    spiRxFifoIsr(void)
    {

        rdata_point++;
        rdata[ldptr++] = SpiaRegs.SPIRXBUF;

    }

    With This code I am not able to get the data from slave as I thing there is delay in providing clock to Slave.

    Please suggest any solution or code to provide clock to SPI slave to acquire data.

    Thanks & Regards,

    Sachin

  • Hi Sachin,

    I am assuming that the F8335 is the Master device. What is the slave device you are using?

    A few questions about your initialization. Is your talk bit enabled? You can enable it once you are ready for communication to start.

    Do you use a slave select pin? Is the clock polarity the same between the two devices?

    It would help to see the initialization code first.

    Best,

    Marlyn