I am working on a project that requires rapidly transferring 127-190 KB over SPI within 26 milliseconds. The SPI bus speed is limited by the connected component to 50-60 MHz and individual transfers no larger than 3*2048 bytes. After receiving the data over SPI, and DMA'ing it into memory, it is then transferred over USB to a connected host.
The custom board does not have flash or connected RAM. The program is serially loaded over USB and operates entirely from ITCM/DTCM and OCRAM.
The data is being received into alternating buffers placed in OCRAM and aligned to 32-byte boundary. When one buffer is being received from LPSPI+DMA the other buffer is transmitted over USB.
This process is working in general but sometimes I receive sections of data that were not updated, they contain the same contents from the previous time that same buffer was used. It appears that the data was lost between the DMA and the actual memory making me suspect some sort of issue with a cache. I have confirmed the data is changing over SPI, and since SPI is operating without any gaps, clearly the DMA engine has been reading the data from the LPSPI receive fifo.
During testing I have tried modifying the LPSI clock root data rate for performance reasons. I have seen fewer issues when I operate the LPSI clock at a high rate that actually exceeds the maximum rating. When I operate the LPSI within the maximum rating of 133 MHz I encounter the issue quite at least a few times a second.
The very frustrating part is that the issue is quite intermittent and sometimes minor and unrelated changes can have a large impact on the frequency.
How do I make the LPSPI+DMA reliably copy data into memory?
Are there any known erratas/gotchas using eDMA on imxrt1062?
This project is using zephyr , but the issues seem to be specifically related to NXP's drivers. I have never encountered problems like this with other vendors chips using SPI and DMA on zephyr.
@Kan_Li Can you recommend another processor from NXP that can achieve SPI master mode timing 50MHz or above? The project requires this high data rate and will select product from another vendor if NXP does not have this capability. ST has candidate processors with faster SPI peripheral.
I saw RT500 processor has a feature called "HS SPI" based on FlexComm peripheral that achieves 50 MHz. Any other processors with similar feature?
I evaluated the FlexIO module in RT1062, but it also has maximum baudrate of FLEXIOx_CLK_ROOT/4 = 120/4 = 30 Mbps.
Also regarding RT1062 LPSPI peripheral. Is there any more detailed information on the 30 MHz limit? We actually have this device operating with SPI above 50 MHz and are not seeing any issues beyond the extra delay I reported, perhaps this specification is overly conservative or based on legacy devices?
Hi @anthony_asterisk ,
Besides RT500 as you mentioned, imx8mp is also recommended for your case, please kindly refer to https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i-mx-applications-proces... for details.
Hope that helps,
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi @anthony_asterisk ,
As far as I know, the max operating clock for LPSPI is 30MHz, making the module work out of spec might cause issue, even with exception, it can not guarantee for mass production. Please kindly refer to the following for more details.
Have a great day,
Kan
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------