Wednesday, April 29, 2009

Microchip PIC SPI CKE and CPE vs. CPOL and CPHA

CKP = CPOL
CKE = opposite of CPHA
CKP     0               0               1               1            Clock Polarity
CKE     0               1               0               1            Clock Edge
        Idle Low        Idle Low        Idle High       Idle High 
        Change L->H     Change H->L     Change H->L     Change L->H 
        Read   H->L     Read   L->H     Read   L->H     Read   H->L 
     
        CKP: Clock Polarity Select bit (CKP == CPOL)
        1 = Idle state for clock is a high level; active state is a low level    
        0 = Idle state for clock is a low level; active state is a high level    
     
        CKE: Clock Edge Select bit (CKE == !CPHA)
        1 = Serial output data changes on transition from active clock state to idle clock state    
        0 = Serial output data changes on transition from idle clock state to active clock state