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.

TMS320F28377S: Why is my SPI clock half the frequency that I expected?

Part Number: TMS320F28377S
Other Parts Discussed in Thread: TMDSCNCD28379D

It looks like SPI A CLK is not the frequency I expected.
On the oscilloscope I measured 5MHz for the SPI A CLK frequency, however I told the SPI_setConfig function to use 10MHz:
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA1, SPI_MODE_MASTER, 10000000, 8);


  • Is SYSCLK running at 200MHz? What about the LSPCLK? By default it runs at SYSCLK/4--did you change that setting?

    And if you did change either of those settings, did you update the macros in device.h (like DEVICE_LSPCLK_FREQ) to match?

    Thanks,
    Whitney
  • Whitney,

    I don't know how to figure out the frequencies for SYSCLK and LSPCLK.
    I don't know how to change the LSPCLK so I believe I haven't changed it unless I did it by mistake somehow.
    I did not make any changes to device.h.
    I'm using the LAUNCHXL-F28377S eval board.

    Thanks,
    Kevin
  • Kevin,

    The LAUNCHXL-F2837xx has a 10MHz clock on the board while the TMDSCNCD28379D has a 20MHz clock on the board.

    The examples are written to work with a 20MHz clock by default and InitSysCtrl() will look for a Predefined Symbol (like _LAUNCHXL_F28377S) to work with a 10MHz clock instead. Check your project properties to see if the symbol is defined.

    -Tommy
  • Kevin,

    I agree with Tommy's assessment--I suspect you need to put _LAUNCHXL_F28377S in your predefined symbols. Note that Device_init() is the driverlib equivalent to the InitSysCtrl() function he mentioned, and you should be able to check device.h to see what the _LAUNCHXL_F28377S symbol affects.

    Whitney

  • I'm using Device_init() but I don't understand what it is doing and I can't find any documentation for it.
    It sounds like it's OK that I'm using Device_init() instead of InitSysCtrl().
    How do I put _LAUNCHXL_F28377S in my predefined symbols?
  • Yeah, it's fine to use Device_init(). I'm afraid we don't have documentation for it at the moment beyond what's in the comments. You can check out the driverlib functions that it calls to get a better idea of what it's doing though. It's mostly setting up SYSCLK, turning on the peripheral clocks, and disabling the watchdog.

    To add _LAUNCHXL_F28377S to your predefined symbols, right click on your project and select Properties. Then look under Build > C2000 Compiler -> Predefined Symbols. It may also be under Advanced Options -> Predefined Symbols depending what compiler version you're using. Once you find the page, add _LAUNCHXL_F28377S to the box labeled "Pre-define NAME (--define, -D)."

    Whitney

  • Whitney,

    Thank you so much for your help!
    This solved my problem.

    Thanks,
    Kevin