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.

TMS320C5515 Chip Support library - the SPI peripheral.

Other Parts Discussed in Thread: TMS320C5515

Hello folks,

                  on reading the CSL documentation for the SPI port, I see that a SPI_dataTransaction function is provided to facilitate communications with SPI based peripherals.

The documentation for this function indicates that four parameters are to be passed, one is the handle, the second is a pointer to a read or write buffer defined as an array of size Uint16, the third parameter is the buffer length and teh last parameter is a "readOrWrite" command indicator.

The SPI port in the TMS320C5515 provides two 16 bit shift registers SPI_DAT2 and SPI_DAT1 that can be concatinated to support character lengths up to 32 bits.

I am looking to understand how the values passed into the function via the read or write buffer array gets loaded into SPI_DAT2 and SPI_DAT1.

Can anyone shed some light onto how the array values are transferred into the 16 bit registers SPI_DAT2 and SPI_DAT1?

Also, what is the relationship between the character length and the buffer length?

Thanks once more in anticipation of your replies.....David

 

  • I located the source code for the spi port which has the following code:

        /* Read the word length form the register */
        getWLen = CSL_FEXT(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CLEN) + 1;

        if(getWLen >= SPI_MAX_WORD_LEN)
        {
            return (CSL_ESYS_INVPARAMS);
        }

        /* Write Word length set by the user */
        while(bufIndex < bufLen)
        {
            /* Write to registers more then 16 bit word length */
            if(getWLen == 16)
            {
                CSL_SPI_REGS->SPIDR2 = writeBuffer[bufIndex];
                CSL_SPI_REGS->SPIDR1 = 0x0000;
                bufIndex ++;
            }
            /* Write to register less then or equal to 16 bit word length */
            else if(getWLen == 8)
            {
                CSL_SPI_REGS->SPIDR2 = (Uint16)(writeBuffer[bufIndex] << 0x08);
                CSL_SPI_REGS->SPIDR1 = 0x0000;
                bufIndex++;
            }

            /* Set command for Writting to registers */
            CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD, SPI_WRITE_CMD);

    As such, I conclude that the CSL code only supports 8 or 16 bit characters so, I will write my own 32 bit handler.....

  • David,

    Your assumption is correct.  Currently the SPI module is limited to 8 or 16-bit length.  This is specified in the API documentation that comes with the CSL package:

    "Word length set for data transmission or receive (supporting 8 bit or 16 bit) "

    Regards.

  • Hello, Maybe this not the correct place to post this question but it also concerns CSL_SPI module.

     

    In the SPI_Open function there is a check for the SPI_Instance variable which is defined as static for that file, but is never initialized.

    When I run the code for the first time value of this variable gets random value so it reports it as "configured" and hSpi returned is NULL; After that I have to restart the code and for the second time everything is OK since the hSpi->configured is set to FALSE.

    Is this a bug in the CSL or am I using the library incorrectly.

    Following is the part of the code for the SPI_Open function:

    hSpi = &SPI_Instance;

    if(hSpi->configured == TRUE)

    {

    hSpi->configured = FALSE;

    hSpi = NULL;

    return (hSpi);

    }

  • I just downloaded the CSL library for the TMS320C55x from http://focus.ti.com/docs/toolsw/folders/print/sprc133.html and it does not have any examples for SPI. Does anybody have an example code showing how to use the SPI peripheal with the TMS320C5515? I am using the C5515 eZDSP USB Stick development tool...

    Thank you,

    Daniel

  • Daniel,

    Hope you have downloaded and installed TMS320C55XXCSL-LOWPWR-2.10.00.00-Setup.exe. You can find the SPI example at c55xx_csl\ccs_v3.3_examples\spi for CCS3.3 and c55xx_csl\ccs_v4.0_examples\spi\CSL_SPI_Example for CCS4

    Pratap