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.
Hi Dave,
Thank you for the info.
That should be the KE02 SPI module driver software issue.
I had reported this issue to related KE product engineer and it will be fixed at next released version.
Thanks again.
Have a great day,
best regards,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------