i.MX8MM ECSPI slave mode restriction

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

i.MX8MM ECSPI slave mode restriction

跳至解决方案
1,469 次查看
AustinHan
Contributor I

I am currently using the i.MX8MM ECSPI Slave in PIO mode.
The issue is that in Slave mode, the burst length appears to be limited to 512 bytes.
While it's not clear whether using DMA mode instead of PIO mode would remove the transmission data size limitation, I have applied a kernel patch to try using DMA mode.

Can I get sample code or materials related to SPI data transmission and reception in Slave mode(using DMA)?
I am referring to the AN13633 document, but I would appreciate any comments if there are other helpful resources available.
Let me know if you would like me to help you find specific resources or documentation about implementing DMA mode for ECSPI on i.MX8MM.

0 项奖励
回复
1 解答
1,252 次查看
joanxie
NXP TechSupport
NXP TechSupport

double checked again, this limitation is HW limitation, the AN is released and based on the old bsp, the new bsp add 512 bytes limitation because of HW limitation, so you couldn't remove this,  it seems imx8mm ecspi couldn't support this(no 512 bytes limitation) if you want to use slave mode

在原帖中查看解决方案

0 项奖励
回复
10 回复数
1,456 次查看
joanxie
NXP TechSupport
NXP TechSupport

AN13633 is very detailed application note for your request, for dma support, you also can refer to the patch as below, and you also can focus on the ERR003775 from errata

LF-6680 spi: imx: add dma support for target mode · nxp-imx/linux-imx@1aef8ed · GitHub

0 项奖励
回复
1,438 次查看
AustinHan
Contributor I

Thank you for your response.

I was trying to enable DMA mode thinking there were no transfer size restrictions in DMA mode.
Based on the linked document, does it mean that both PIO and DMA modes have a 512-byte limit for transfer data size?

标记 (1)
0 项奖励
回复
1,433 次查看
joanxie
NXP TechSupport
NXP TechSupport

yes, DMA has this limtitaion too

0 项奖励
回复
1,370 次查看
AustinHan
Contributor I
I apologize for contacting you.
I have a question I'd like to ask for clarification.
Could you please help me understand the meaning of the note on page 5 of the linked document?

(Link)
https://www.nxp.com/docs/en/application-note/AN13633.pdf

" Note: From testing, it seems no such transfer length restriction must be added in DMA mode. So only PIO mode has this restriction."
0 项奖励
回复
1,319 次查看
joanxie
NXP TechSupport
NXP TechSupport

I checked the driver again, the limitation is

https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/spi/spi-imx.c#L1492

if you want to test this, you can comment the 512 limitation to test based on your detailed user case

 

0 项奖励
回复
1,287 次查看
AustinHan
Contributor I

Thank you for your reply.
But, I didn't understand exactly what you said.
Does annotating the 512 byte limit in kernel code mean I can transfer more than 512 bytes in SPI Slave mode?

if ((is_imx51_ecspi(spi_imx) || is_imx53_ecspi(spi_imx)) &&
transfer->len > MX53_MAX_TRANSFER_BYTES && spi_imx->target_mode) {
    dev_err(spi_imx->dev, "Transaction too big, max size is %d bytes\n",
    MX53_MAX_TRANSFER_BYTES);
    return -EMSGSIZE;
}

0 项奖励
回复
1,253 次查看
joanxie
NXP TechSupport
NXP TechSupport

double checked again, this limitation is HW limitation, the AN is released and based on the old bsp, the new bsp add 512 bytes limitation because of HW limitation, so you couldn't remove this,  it seems imx8mm ecspi couldn't support this(no 512 bytes limitation) if you want to use slave mode

0 项奖励
回复
1,246 次查看
AustinHan
Contributor I

Thank you for your quick response.
Have a nice day.

0 项奖励
回复
1,344 次查看
joanxie
NXP TechSupport
NXP TechSupport

confirmed that DMA/PIO mode has 512 limitation, and DMA has 4 bytes align limitation, you can refer to the patch I sent to you before

0 项奖励
回复
1,431 次查看
AustinHan
Contributor I

Thank you for your quick reply.

0 项奖励
回复