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.

Changing the SPI module clock frequency in the C6748 LCDK

Hi All, 

The SPI module in the C6748 LCDK is configured at 150MHz.  I would like the SPI module to be configured at 1MHz from which i could compute a prescalar value that would give me an output SPI_CLK of 8KHz. I would like to know where can i change the input SPI module clock (ie 150MHz to 1MHz). I tried looking at the GEL file, but couldn't locate the SPI clock there...or have i missed something. Any pointers would be great.

Thanks much

Smita

  • Hello Smita,

    Yes, you may need to change the prescale value in the SPIFMTn.PRESCALE register to change the SPI module clock. This SPIFMTn register configuration being done in the SPI initialization (Please refer section 30.2.19 in TRM) which would be a part of SPI driver.

    Please refer C6748 PLL calculator to identify the prescale value for your requirement.

    processors.wiki.ti.com/.../AM18xx

    Regards,
    Senthil
  • Hello Senthil,

    Thanks for the reply. Yes, i did have a look at the SPIFMT register. As seen in the TRM description, the prescalar can be computed using-

    PRESCALE = (SPI module clock/SPI clock frequency )-1

    For my application, I need the SPI clock frequency to be 8KHz. I am using the SPI example in the staterware as a starting point. In that example, the SPI module clock is 150MHz. So, using that i get a PRESCALE value of 18749 or 0x493D. But the PRESCALE value in SMTFMT register is only 8 bit wide. So i may have to change the SPI module clock from 150MHz to 1MHz. Could you please tell me where can i make this change. Is it in the GEL file. Any pointers would be great!
    Thanks and regards,
    Smita
  • Hello Smita,

    Which SPI bus you are considering here ? SPI0 or SPI1 ?

    For SPI0, the SPI module clock (PLL0.SYSCLK2) is fixed ratio to SYSCLK1/2 and you cannot change it. The minimum SPI clock you could achieve is ~600KHz with maximum prescale of 255.

    For SPI1, even if you change the SPI module clock to PLL1.SYSCLK2 by changing the CFGCHIP3[ASYNC3_CLKSRC] register, it would affect the DDR internal source clock.

    Do you want to use DDR2 in your project ?

    Why do you want to run the SPI clock at 8KHz ?

    Regards,
    Senthil
  • Hello Senthil,

    Thanks much for all the information provided.

    We would be using SPI1 bus. Our application requires that we send audio data in real time from from the DSP to a microcontroller via the SPI interface. The audio data is sampled at 8KHz (at the AIC3106 codec). Hence i will need to configure the SPI output clock frequency (that drives the slave) at 8KHz. After doing the math, i see that the SPI module input clock has to be lesser than 150MHz because PRESCLAR value cannot be greater than 8 bit. The only option was to change the SPI1 input module clock to 1MHz, so that the SPI1 output clock to slave is 8KHz. Could you please tell me if this is achievable? Or do i need to use some other communication interface? The main objective is to send 8KHz audio data (sampled by the AIC3106 codec) to a microcontroller via the C6748 DSP....so could you please suggest a suitable communication interface for this to be feasible? I was thinking if the SPI clock that drives the slave can be configured at 8KHz, it would solve the problem. Thanks for the inputs!

    Also in case the audio data needs to be stored to SDRAM, the DDR would be used. At the moment data is not stored in SDRAM.

    Thanks once again and do let me know in case i need to make more clarifications.

    Regards
    Smita