This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SPI Clock Phase is inverted from SPI protocol



It seems that the Clock Phase setting for the SPI is exactly the opposite of what everyone else using SPI indicates as a specification. For example, Figure 14-25 in the Technical Reference Manual has a graph for Clock Polarity = 0 and Clock Phase = 0, and it shows data change on the rising edge and data sampling (which happens in the middle of the bit period) on the falling edge. Likewise, the following 3 graphs for the othe SPI modes show this same inverted Clock Phase behavior.

Every other SPI specification has sampling on the first edge (falling or rising determined by Clock Polarity) for the modes where Clock Phase = 0, and second edge for Clock Phase = 1. For example:
http://www.rosseeld.be/DRO/PIC/SPI_Timing.htm
http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers.


This is not just a problem of mislabeled graphs in the TRM, I verified this on the oscilloscope and the clock behavior is actually inverted.

Edit: I am working with the F28M35H52C1

  • I've seen the same sort of thing on the OMAP-Lxxx and derived family of processors. Texas Instruments even goes their own way with naming SIMO/SOMI  vs MOSI/MISO. Just easier to view TIs POLARITY/PHASE are not the same as others CPOL/CPHA. Historically, Texas Instruments, Motorola and National Semiconductor all defined SPI slightly differently. General purpose SPI controllers had to define a mode to cover those formats. TI could plausibly claim to be correct and everybody else wrong.

  • Ok, thanks for the explanation. I understand now that this is just a proprietary issue, rather than a mistake.

  • I don't believe there is an official standard for SPI but Texas Instruments could have tried to use the defacto definition of CPOL and CPHA for their generic SPI controllers. I remember the Intel PXA chips has specific modes for TI, Motorola, NatSemi and custom. The custom mode used a parameter called SCMODE to define the polarity and phase. The CPOL and CPHA terminology appears to have come from FreeScale. I guess the problem is that a lot SPI devices will have documentation with that terminology.