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.

TMS320F28377D: driverLib SPI initialization

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Is there additional driverLib initialization required for a very simple SPI example?  Please see the code below.

The data in present in the SPITXBUF register when debugging (0x014D = 333), but there is no data or clock present on the controlCard pins when viewed with a scope.  Checking pins 67 (SPISIMOA), 69 (SPISOMIA), and 71 (SPICLKA).

What have a missed?

Kindly,

Graham

#include "F28x_Project.h"

#include "driverlib/spi.h"

/**
 * main.c
 */
  void main(void)
  {
      uint32_t delay;

      InitSysCtrl();

      SPI_disableModule(SPIA_BASE);

      SPI_setConfig(SPIA_BASE,  100000000,  SPI_PROT_POL0PHA0, SPI_MODE_MASTER,  500000,  16);

      SPI_enableModule(SPIA_BASE);

      while (1)
      {
          SPI_writeDataNonBlocking(SPIA_BASE, 333 );

          // Delay for a bit.
          for(delay = 0; delay < 2000000; delay++)
          {}
      }
  }

  • Thanks Baskaran for replying.  

    Although, my question stems from reading the documentation and the examples.

    For example, in the DriversLib User Guide, section 27.2.1, it briefly explains how to set up the boiler plate code for SPI usage via ~/driverlib/spi.h.  I believe the code above attempts to do that.

    In the three SPI examples in the C2000Ware folder, ~/device_support/f2837xd/examples/cpu/, spi_loopback, spi_loopback_dma, and spi_loopback_interrupts, it looks like a method is used other than the Software Driver Model, mentioned in section 3.3 of the DriversLib User Guide.

    I'd like to utilize the Software Driver Model, via spi.h, than what looks more like a direct registery access in the three spi examples.

    Kindly,

    Graham

     

  • Hi Graham,

    The SPI examples that use the driverlib are found under:

    C2000Ware_x_xx_xx_xx\driverlib\f2837xd\examples\cpu1\spi

    Whitney
  • Thanks Whitney.

    Though I don't understand how this helps. In the previous post I called out the discrepancies between the example code and the documentation.

    Graham
  • It sounded like in your previous post that you were looking at the examples that were written with bit-field structures in a different directory. The examples in the directory I mentioned DO use the driverlib and should demonstrate the APIs covered in the driverlib User's Guide. Did you look at the examples in driverlib\f2837xd\examples\cpu1\spi?

    They should also demonstrate how to configure pins as SPI pins which your code above appears to be missing.

    Whitney