iMX6ULL ECSPI Master Mode with Phase Control

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

iMX6ULL ECSPI Master Mode with Phase Control

跳至解决方案
1,136 次查看
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.

标签 (1)
0 项奖励
回复
1 解答
1,069 次查看
kef2
Senior Contributor V
Yes, they are standard.

在原帖中查看解决方案

5 回复数
1,109 次查看
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 项奖励
回复
1,089 次查看
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 项奖励
回复
1,082 次查看
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 项奖励
回复
1,074 次查看
hsgim
Contributor II

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

Thanks,

0 项奖励
回复
1,070 次查看
kef2
Senior Contributor V
Yes, they are standard.