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:
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:
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:
This resolved the problem. However, I noticed other, similar bit test areas with the same issue, so those need to fixed, also.