ARM SoC+FPGA/CPLD is widely used in some application like industry control and data acquisition system, there were many customers adopted i.MX6 EIM (a memory parallel interface) to access FPGA/CPLD, and archived good data throughput, but EIM is removed from i.MX8M and i.MX9, some customers is asking for such a compatible solution for i.MX8/8M and coming i.MX9 family. FlexSPI is designed for connecting storage devices like NOR Flash, integrated in most of i.MXRT/i.MX8/LS products and provides flexible configuration for 4-wire/8wire working mode, this article provides a low-cost and efficiency demo to show how to support CPLD/FPGA via FlexSPI, as a replacement of EIM for EP i.MX8/9/LS products.
Hardware Prepare:
i.MX8MM-LPDDR4-EVK
Lattice LFE5U EVK
Figure1 4-wire SPI HW Block diagram
Figure2 8-wire OctalSPI
1 Need to remove the SPI-Flash(U5, MT25QU256ABA) on the i.MX8MM-EVK board, and wire below signals:
QSPI_DATA0
QSPI_DATA1
QSPI_DATA2
QSPI_DATA3
QSPI_SCLK
QSPI_nSS0
VDD_1V8
GND
Figure3 QPSI signals for FPGA/CPLD
Figure4 Hardware rework on i.MX8MM-EVK board
Note that, i.MX8MM-EVK QSPI power rails is 1.8v, so be careful that the FPGA/CPLD side IO should be 1.8V.
1 Linux BSP version: L5.10.52
$make -C $(YOUR_KDIR) M=$(FlexSPI_FPGAW_DIVER_DIR) modules ARCH=arm64 CROSS_COMPILE=$(CROSS_COMPILE)
$insmod imx_flexspi_fpga.ko pre_div=2 post_div=5
Read/write FPGA/CPLD test
.$/flexspi_fpga_test -p 0x08000000 -s 768
$ insmod imx_flexspi_fpga.ko pre_div=1 post_div=4
Read/write FPGA/CPLD test
$./flexspi_fpga_test -p 0x08000000 -s 768
− “Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable law. NXP accepts no liability for any assistance with applications or product design. Materials may only be used in connection with NXP products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.”
I've built flexspi_fpga_driver of kernel. and then used your flexspi_fpga_test.
Before connect FPGA, just checked signals (clk, cs, data0). it seems right.
I've also hecked that clock is right by scope. (40MHz and 100MHz)
I plan to connect FPGA on i.MX8M plus through flexspi, could you share source code of "flexspi_fpga_test"? , thanks a lot.
Hi,
Can you please provide us the source code of flexspi_fpga_test.zip ?
Thanks & Regards,
Poojashree Shetty