iMX6ULL ECSPI Master Mode with Phase Control

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6ULL ECSPI Master Mode with Phase Control

Jump to solution
1,135 Views
hsgim
Contributor II

Hello,

According to IMX6ULLRM, it reads

When the Phase control (ECSPI_CONREG[PHA]) bit is set, the transmit data will shift out on the rising edge of SCLK, and the receive data is latched on the falling edge of SCLK. The most-significant bit is output on the first rising SCLK edge.

When ECSPI_CONREG[PHA] is cleared, the transmit data is shifted out on the falling edge of SCLK and the receive data is latched on the rising edge of SCLK. The MSB is output when the host processor loads the transmitted data.

It sounds like CPHA has nothing to do with CPOL.

But according to Wikipedia, it looks like CPHA is dependent on CPOL.

Doesn't ECSPI coincide with the standard SPI?

Below is a description from Wikipedia.

Thanks,

 

CPOL determines the polarity of the clock. The polarities can be converted with a simple inverter.
CPOL=0 is a clock which idles at 0, and each cycle consists of a pulse of 1. That is, the leading edge is a rising edge, and the trailing edge is a falling edge.
CPOL=1 is a clock which idles at 1, and each cycle consists of a pulse of 0. That is, the leading edge is a falling edge, and the trailing edge is a rising edge.
CPHA determines the timing (i.e. phase) of the data bits relative to the clock pulses. Conversion between these two forms is non-trivial.
For CPHA=0, the "out" side changes the data on the trailing edge of the preceding clock cycle, while the "in" side captures the data on (or shortly after) the leading edge of the clock cycle. The out side holds the data valid until the trailing edge of the current clock cycle. For the first cycle, the first bit must be on the MOSI line before the leading clock edge. An alternative way of considering it is to say that a CPHA=0 cycle consists of a half cycle with the clock idle, followed by a half cycle with the clock asserted.
For CPHA=1, the "out" side changes the data on the leading edge of the current clock cycle, while the "in" side captures the data on (or shortly after) the trailing edge of the clock cycle. The out side holds the data valid until the leading edge of the following clock cycle. For the last cycle, the slave holds the MISO line valid until slave select is deasserted. An alternative way of considering it is to say that a CPHA=1 cycle consists of a half cycle with the clock asserted, followed by a half cycle with the clock idle.

Labels (1)
0 Kudos
Reply
1 Solution
1,068 Views
kef2
Senior Contributor V
Yes, they are standard.

View solution in original post

5 Replies
1,108 Views
AldoG
NXP TechSupport
NXP TechSupport

Hello,

Yes it does comply, I do not actually understand your question I see the same description in both scenarios, just to be clear please take the following in consideration.

POL determines the clock polarity, while PHA controls how the data shifts in and out.

Also, please note that the peripheral behavior is explained in each scenario in the i.MX6ULL reference manual, either slave or master for each combination of PHA & POL.

Best regards,
Aldo.

0 Kudos
Reply
1,088 Views
hsgim
Contributor II

Thanks for the reply.

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface#/media/File:SPI_timing_diagram2.svg

spi_timing.JPG

For Wikipedia,

when CPOL 1 (the leading edge is a falling edge, and the trailing edge is a rising edge) and CPHA 0, the data shifts out on the trailing (rising) edge and shifts in on the leading (falling) edge.

And when CPOL 1 and CPHA 1, the data shifts out on the leading (falling) edge and shifts in on the trailing (rising) edge.

But for IMX6ULLRM, independently of CPOL,

when CPHA 0, the data shifts out on the falling edge and shifts in on the rising edge.

And when CPHA 1, the data shifts out on the rising edge and shifts in on the falling edge.

It doesn't coincide with the case "CPOL 1" of the description from Wiki.

Thanks,

0 Kudos
Reply
1,081 Views
kef2
Senior Contributor V

Yeah, CPOL/CPHA description in iMX6ULLRM is broken. Figure 20-10 is unusable; it shows some SPI clocks and some arbitrary MOSI/MISO data without shown SCK to data relation, just coinciding data and SCK edges. 

0 Kudos
Reply
1,073 Views
hsgim
Contributor II

Then, could I expect the actual operation to coincide with all 4 standard modes?

Thanks,

0 Kudos
Reply
1,069 Views
kef2
Senior Contributor V
Yes, they are standard.