Hi experts,
Recently I am debuging imx8mq M4 spi, but I have some doubts about the ecspi controller.
1. As all know, SPI has 4 mdoes, and the modes are controlled by Clock polarity(CPOL) and phase(CPHA). But in ecspi controller, why besides SCLK_POL and SCLK_PHA fileds in ECSPIx_CONFIGREG register, it has SCLK_CTL and DATA_CTLfields. What's the function of these two. Because if I have configred the spi mode, the SCLK inactive state is clear, for example, when setting spi mode 3, then the SCLK inactive state is high.
2. So when I use the the SDK v2.9.0 spi driver to develop flash driver(W25Q128), W25Q128 supported spi mode 3, then the strange things happened.
- When I configured SCLK_POL = 1 and SCLK_PHA = 1, SCLK_CTL = 0, DATA_CTL = 0, and I sent (0x90 0x00 0x00 0x00 0xff 0xff) to read W25Q128 ID, the oscilloscope waveform is like below(just show the sending data of 0x90. the blue is sclk and yellow is MOSI), the data(ID) read from W25Q128 is not correct, it is 0x0AD1:

- When I configured SCLK_POL = 1 and SCLK_PHA = 1, SCLK_CTL = 1, DATA_CTL = 0, and I sent (0x90 0x00 0x00 0x00 0xff 0xff) to read W25Q128 ID, the oscilloscope waveform is like below(just show the sending data of 0x90. the blue is sclk and yellow is MOSI), the data(ID) read from W25Q128 is not correct, it is 0x0000:

- When I tested on the STM32F407 board using the same SPI mode 3(SCLK_POL = 1 and SCLK_PHA = 1), the oscilloscope waveform is like below(just show the sending data of 0x90), and the data read from W25Q128 is correct, it is 0xef17:

As you can see, the waveform is different, and the STM32F407 wareform is the same with standard SPI mode 3.
So the question is why? And how can I set the correct SPI mode 3 of imx8mq?
I tried a lot, but all failed.
Hope you can help me.
Thanks.
Edward