i.MX8MM ECSPI slave mode restriction

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

i.MX8MM ECSPI slave mode restriction

Jump to solution
1,468 Views
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 Kudos
Reply
1 Solution
1,251 Views
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

View solution in original post

0 Kudos
Reply
10 Replies
1,455 Views
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 Kudos
Reply
1,437 Views
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?

Tags (1)
0 Kudos
Reply
1,432 Views
joanxie
NXP TechSupport
NXP TechSupport

yes, DMA has this limtitaion too

0 Kudos
Reply
1,369 Views
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 Kudos
Reply
1,318 Views
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 Kudos
Reply
1,286 Views
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 Kudos
Reply
1,252 Views
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 Kudos
Reply
1,245 Views
AustinHan
Contributor I

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

0 Kudos
Reply
1,343 Views
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 Kudos
Reply
1,430 Views
AustinHan
Contributor I

Thank you for your quick reply.

0 Kudos
Reply