Set SPI speed to 400Khz & 4mhz

cancel
Showing results for 
Search instead for 
Did you mean: 

Set SPI speed to 400Khz & 4mhz

401 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Deepak Bansal on Mon Sep 24 04:17:53 MST 2012
Hi I have to set SPI module, first 400Khz & then 4Mhz. System freq is 72Mhz.
is it right....... do i have to give some delay after changing scr for getting stable  frquency.

SSP0CLKDIV = 0X01;            //FREQ IS 72MHZ TILL NOW
CS=1;              //DIABLE SD CARD
CPSR=2;            NOW FRQ IS 36MHZ
SCR = 89;                // 36MHZ/(2*(89+1)) = 400KHZ


CS=0;
DO ONE TASK


CS=1;      //DISABLE CS SELECT TO CHANGE FREQ
SCR=8;     //NOW FRQ HAS CHANGED TO 4MHZ.
DO SECOND TASK
0 Kudos
0 Replies