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: SPI Clock Frequency?

Part Number: TMS320F28377D

Hello there,

I am a bit confused on who controls the SPI clock frequency coming out of SPI CLOCK pin? 

  • Is it LSPCLK?
  • Is it the baud rate register? SPIBRR?
  • What is PCLKCR8? 

SPI data capturing works with rising or falling edge of the SPI Clock? Then what is Baud rate ? If the clock frequency is high then rising/ falling edges are high in number so what does SPIBRR does with respect to LSPCLK? 

My LSPCLK is at 50MHz, I am looking for 5MHz SPI clock. Do I have to write a value of (10 or 11) in SPIBRR to get 5Mhz? 

Regards

Varun

  • Hello Varun,

    First thing first,

    1) SYSCLK (main clock)
    * It is the clock at which CPU is running. Which is also used by hardware accelarators such as CLA, FPU, TMU etc.
    * It's a high speed clock.

    2) LSPCLK (low speed clock)
    * Communication and data acquisition peripherals (SPI,SCI) are slower in speed so SYSCLK can be divided by using low speed peripheral clock prescalar (LOSPCP) of /1, /2,/4 ,/6, /8 so on which gives you LSPCLK.

    LSPCLK = SYSCLK / prescalar

    3) PCLKCR8 (Gate register)
    * Now you have the LSPCLK clock available but its not connected to the SPI module yet.
    * You can enable it by setting bit corresponding to your SPI_x module in the PCLKCR8 register.

    4) How to Calculate Baudrate
    Here's the simple relation between LSPCLK and SPI Baudrate (essentially SPI clock)

    (SPICLK) = = LSPCLK / (SPIBRR + 1) 

    5 MHz = 50 MHz / (SPIBRR + 1)

    SPIBRR = 9

    You can find more information in the section 8.3.5 Baud Rate Selection of the link given at the end of this post

    5) ""SPI data capturing works with rising or falling edge of the SPI Clock? Then what is Baud rate ?""

    Baud rate is the defined as symbols/second, in SPI communication which is equal to the SPI clock rate.

    6) ""If the clock frequency is high then rising/ falling edges are high in number so what does SPIBRR does with respect to LSPCLK? "
    This question doesn't quite make sense.

    I would read the section 2.7 (Clocking) and 18 (SPI Module) of the following link to understand the basics better.
    www.ti.com/.../spruhm8g.pdf

    Hope this helps.

    Thanks,
    Rahul Birari

  • Thanks man. Appreciate your quick and long reply! :)