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.

Configuring SPI DMA in TI-RTOS for CC3200.

Other Parts Discussed in Thread: CC3200

Hi,

I want to configure the SPI DMA to transmit data on the TI-RTOS.I am using the CC3200 EVAL Board.Is there any example code or can anyone help me understand how to configure the DMA for SPI.I have written the SPI driver for CC3200(without DMA).Also I have seen the uartechodma example provided and I cannot see where is the DMA being initialized or used.

Thanks 

  • John,

    There is a CC3200 SPI driver using DMA in the TI-RTOS product installation that you can look at for reference.  You can find the source at a location similar to: C:\ti\tirtos_cc32xx_2_16_00_08\products\tidrivers_cc32xx_2_16_00_08\packages\ti\drivers\spi\SPICC3200DMA.c

    We don’t ship an example app that uses this (but we probably will in future releases).  I'll attached a .c and .cfg file of an internal test that you can look at for reference though.  You might modify this example to use the SPICC3200DMA driver,  removing the slave code, and testing the master function, with a logic analyzer if you have one available.

    Regards,
    Scott

    2061.spiloopback.c5516.spiloopback.cfg

  • ScottG,

    I wanted to know the sequence on how to integrate the DMA code with the spiloopback example you have given me.As i can understand that the spiloopback example does not currently use the DMA and to use the SPI DMA I need to use the API's from SPICC3200DMA.c ,Am I wrong?

    Can I get to know the exact sequence of SPI DMA initialization?
  • John,

    This loopback example uses general SPI APIs, like SPI_open().  (You don’t need to call any SPICC3200DMA-specific APIs.)   These general APIs get redirected to the configured driver implementation.  For example, the source for SPI_open() (in SPI.c) is below.  There are first some checks of the driver config and params, and then a call to the configured open function:

    /*
     *  ======== SPI_open ========
     */
    SPI_Handle SPI_open(unsigned int index, SPI_Params *params)
    {
        SPI_Handle handle;

        if ((int)index >= SPI_count) {
            return (NULL);
        }

        /* If params are NULL use defaults */
        if (params == NULL) {
            params = (SPI_Params *) &SPI_defaultParams;
        }

        /* Get handle for this driver instance */
        handle = (SPI_Handle)&(SPI_config[index]);

        return (handle->fxnTablePtr->openFxn(handle, params));
    }

    The driver function table is setup in the TI-RTOS board file, and this will re-direct to the SPICC3200DMA functions.  For example:

    const SPI_Config SPI_config[] = {
        {
            .fxnTablePtr = &SPICC3200DMA_fxnTable,
            .object = &SPICC3200DMAObjects[0],
            .hwAttrs = &spiCC3200DMAHWAttrs[0]
        },

    I think you can try this...  Open CCS, and then View->Resource Explorer.  Navigate to the TI-RTOS for CC3200 package, and then: Wireless Connectivity->CC3200->CC3200-LAUNCHXL->Driver Examples ->Empty Examples, and click Empty Project.  Then click “Step 1: Import the example project into CCS”.  In the Project Explorer view, in the new project, right click on “empty.c” and select “Exclude from build”.  Then right click on “empty.cfg” and select “Exclude from build”.  Then copy/paste the spiloopback.c and spiloopback.cfg files into the project.  Then right click on the project and select “Clean project” and when that is done right click on the project and select “Build project”.  There will probably be an error that Board_SPI1 is undefined.  You can then edit spiloopback.c, to comment out the slaveTaskFxn(), as well as the Task_construct call for the slaveTaskFxn. The project should then build without error.  

    Now you can go back and edit the SPI driver configuration in CC3200_LAUNCHXL.c  Search for the “SPI” configuration block, and then change the SPICC3200DMA_HWAttrs as appropriate for your connection.  Then you can try running/stepping the app, to observe the initialization and execution.

    I just tried the above build sequence and was able to build the executable.  I don’t have a setup with me to try running it.  But I think this should jump start you to trying out the driver to see the different steps and execution flow…

    Hope this helps…

    Regards,
    Scott