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.

Initializing SPI on tms320c5515

Other Parts Discussed in Thread: TMS320C5515, ADS1298R

Hi,

I am trying to set up a SPI communication between TMS320C5515 and ADS1298R and I am having problems with initializing SPI on TMS320C5515. I am following the c5515 SPI User guide (sprufo3). I wrote a program in Code Composer for Initializin SPI:

//Reset of the SPI module

SYS_PRCR=0x0080;
value=SYS_PRCR;
while (value !=0){

//checking if the SPI module is turned on
value=SYS_PRCR;
}
if (value==0)
{

//Enabling the SPI input clock
SYS_PCGCR1=0x0000;

//Specifying how many clock cycles is reset asserted
SYS_PSRCR=0x0020;

//Disabling SPI_CLK
SPI_SPICCR=0x0000;

// setting CLKDV
SPI_SPICDR=0x0010;

//enabling SPI_CLK
SPI_SPICCR=0x8000;

//Setting up clock phase
SPI_SPIDCR1=0x0000;
SPI_SPIDCR2=0x0000;

//Setting interrupt
SPI_SPICMD1=0x4040;

//reading or writing
SPI_SPICMD2=0x003A;

//Enabling the SPI pins through the external bus selection register
SYS_EBSR=0x1A3F;

}

I am using the Code Composer debugger and watching how the registers are set step by step (by using Step Into) rather then letting the program Run. As far as I can see, all registers are set up correctly. After the step of  setting up SPICMD2 (SPI_SPICMD2=0x003A), SPISTAT1->CC (character complete) becomes set, also SPISTAT2->CCNT (character count) is equal =0x01.

I am using the oscilloscope and watching the SPI_CLK pin, after the set up is finished there is no Clock signal on the pin. My question is am I doing something wrong (maybe skipping a step).

Thanks for any help.

  • Hi, 

    There exist an SPI related example   - " CSL_SPI_Example_Out" in C55XCSL-LOWPOWER - CSL package.

    Although this example is meant for SPI EEPROM transfers, but will help understand on SPI initialization process.

    The CSL package is downloadable from -  

    Hope this information helps. Let us know if you have any further questions.

    Regards

     Vasanth

  • Hi Vasanth,

    Thank you for the advice, I am now using SPI_example from the CSL. I can see that SPI is being used to communicate with SPI EEPROM, however this program is quite confusing. So I have one more question. If I am reading the SPI manual in the right way, by setting the EBSR register to mode 5 I am supposed to enable the SPI pins on the J13 connector. I am trying to watch the signals on the J13 connector pins, and I found in the program where the EBSR is set to mode 5, but I still cant read anything from the J13 connectors pins of my TMS320C5515 EVM. Is there anything else I am suposed to set in the program for the signals to show on the J13 connector?

    Thank you for all your help.

    Regards

    Darko
  • Hi Darko,

    I used the same CSL example(SPI_example) to probe on J13 pin 3 (SPI CLK) and pin 11 (SPI TX) , I could observe both the clock and data. EBSR parallel mode was set to mode5. I tried even with mode3 and observe the same behavior.

    Can you probe these pin with the right trigger and should work.

    Hope this clarifies.

    Regards

     Vasanth