AnsweredAssumed Answered

Problem with SPI functions in IAR Kickstart for KE02Z FRDM board.

Question asked by Dave Telling on Feb 12, 2015
Latest reply on Feb 12, 2015 by Hui_Ma

I was working with the SPI on a FRDM-KE02Z board, and was modifying the SPI_Master_Poll demo workspace by changing the clock polarity and phase bits. There is a line in the app code:

sSPIConfig.sSettings.bClkPhase1        = 1;

This allows (or should allow) one to change the clock phasing as desired. However, I found that if I set that parameter to '0' (zero), the clock phase did not change. In looking through the various driver files, I found this, which is used to determine the level to set that particular bit:

if( pConfig->sSettings.bClkPhase1)
{
    SPI_SetClockPhase(pSPI,1);
}

Since the phase bit comes out of reset as a '1', commanding a '0' will never happen, because the "if" statement only does something  if the commanded bit is true (or set to '1'). To fix this, I just added a following "else" options:

else

{

     SPI_SetClockPhase(sSPI,0);

}

This resolved the problem. However, I noticed other, similar bit test areas with the same issue, so those need to  fixed, also.

Outcomes