hello,
i am working on KL25Z.
i need to set SPI Clock rate about 8 MHz how can i set this ?
In SPI BR register i can not set to 8 MHz..
Hello Arth Shah,
You can use the SPI1, the clock source is the system clock, the system clock can up to 48Mhz, let's take system clock = 48Mhz as an example.
Now, follow this picture to calculate the SPPR and SPR.
8Mhz= 48M/(SPPR+1)*2^(SPR+1)
So, SPPR=2, SPR=0 can get 8Mhz baudrate.
You can configure SPI1_BR=0X20.
If your bus is 24Mhz, you can't use the SPI0 get 8Mhz, SPI0 clock source is bus clock.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------