iMX8MM, ECSPI as master, special handling of slave select signal

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

iMX8MM, ECSPI as master, special handling of slave select signal

跳至解决方案
1,714 次查看
Raal
Contributor III

Hello,

I've a question about the handling of the ECSPI slave select signal in master mode: the connected slave device uses a protocol where the first byte is the number of following bytes for both command and answer.

In half-duplex, for commands it is known how many bytes must be transferred and the device will send padding bytes if no answer is available. But receiving the answer needs the first byte read to be evaluated to know how many additional bytes must be read. For full-duplex, the first byte received must be evaluated when transmitting a command to decide if the master must send additional padding bytes. In any case, the slave select signal must not be deasserted within commands/answers.

Now, I wonder if this can be achieved by the ECSPI hardware or if the SS signal should be implemented by GPIO function.
The only way I see for using the ECSPI SS signal is using wait states and clearing the SS_CTL flag. According to the reference manual this should be possible, but it's not clear if the wait state only applies if the Tx FIFO is empty or if it's applied after each byte.

Any recommendations/suggestions?

Regards

0 项奖励
回复
1 解答
1,677 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hi 

>> I can assume it's not possible to let the ECSPI hardware handle this? 
SPI IP(hardware) will cooperate with cs-gpios, which is controled by ecspi driver.


>> GPIO is the recommended way?
Yes, right.

 

Best regards

Harvey

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,694 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hi @Raal 

cs can be realized by gpio as below. 

cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;

 Please refer to the link as reference. imx8mn-evk.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel (codeaurora.org)

 

Best regards

Harvey

0 项奖励
回复
1,687 次查看
Raal
Contributor III

Hello @Harvey021 

thank you for that link. So, I can assume it's not possible to let the ECSPI hardware handle this? GPIO is the recommended way?

Regards

0 项奖励
回复
1,678 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hi 

>> I can assume it's not possible to let the ECSPI hardware handle this? 
SPI IP(hardware) will cooperate with cs-gpios, which is controled by ecspi driver.


>> GPIO is the recommended way?
Yes, right.

 

Best regards

Harvey

0 项奖励
回复
1,671 次查看
Raal
Contributor III

Hello @Harvey021 

okay, thank you.

Regards

标记 (1)
0 项奖励
回复