4 flash devices in FLEXSPI2 peripheral on our custom board based on RT1062 SOC #49736
-
Hey, I would like to get your help with zephyr. pinmux_flexspi2_a: pinmux_flexspi2 { pinmux_flexspi2_b: pinmux_flexspi2_b { flexspi2 declaration in my dts file: /* Nand Devices */ Can you please tell me how can I declared it correctly in the dts file because I have many compilation errors and if you can also send me a code sample which does this chip select and write to the chosen device I will be very grateful. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Hi @ofirshe , I was able to tweak your devicetree and get it to build. I added your additions for FlexSPI2 to the mimxrt1060_evk DTS, then made my changes, and I could build it. Below are the FlexSPI2 configuration I used. Unfortunately without hardware to match, I can't test that any of this works. So please let me know what you find. I also have some additional notes for you: Be aware that the memory map available for FlexSPI2 is limited to 240MB. I point this out because based on the sizes of your flash devices, I see 2 devices with 128MB each plus 2 devices of 8MB each. But if you are wanting to use the AHB memory-mapped access, the address range on the RT1060 is 0x7000_0000 to 0x7EFF_FFFF, or 240MB. Reading the FlexSPI chapter, I see the FLSHSZ parameter enables up to 512MB for the combined flashes. Maybe that means you could access all your flash memory using FlexSPI IP commands. But I want to make sure you are aware of the memory-map limit. You need the reg property of each flash to range from 0-3. Meaning the two devices on portB should use 2 and 3 for the reg property. The reg property determines the index of the FLSHCR registers in the FlexSPI, and the MCUXpresso SDK driver uses this flexspi_port_t enumeration for the 4 options. And note that your DTS used a binding for micron,mt29f8g01adbfd12-it, which I did not find in the Zephyr tree. So I changed this to nxp,imx-flexspi-nor just to be able to build the DTS. Also, you asked for a code sample which does this chip select and write to the chosen device. Once the FlexSPI is configured, the chosen device and chip select are just determined by the address requested. The FlexSPI will use the FLSHSZ bits in the FLSHxxCR0 registers (which are configured from your DTS) to translate the address to the flash device and chip select. For more details, see the FlexSPI chapter of the RT1060 Reference Manual, and search for FLSHSZ. If you have the FlexSPI configured for AHB memory-map, you just read from an address offset with base 0x7000_0000. Or you can use the Zephyr flash driver APIs with the desired address. For examples, you can refer to the flash_shell sample, or the flash test. Best regards FlexSPI2 in DTS
pinctrl for FlexSPI2:
|
Beta Was this translation helpful? Give feedback.
-
Hi @ofirshe , For your NAND .YAML file, you can copy nxp,imx-flexspi-nor.yaml and rename for your flash. The key include you need is to nxp,imx-flexspi-device.yaml, as that file has all the bindings for the FlexSPI driver. The more challenging task is to create the flash driver files. You can refer to existing drivers in the tree as examples, like flash_mcux_flexspi_nor.c or flash_mcux_flexspi_mx25um51345g.c. Then you can tweak for the FlexSPI configuration and initialization required for your flash device. I don't know if this NAND device is similar to a driver that NXP already has for the FlexSPI. But if you need help from NXP to configure the FlexSPI for a specific memory, you can request support on NXP's Community forum at https://community.nxp.com/t5/i-MX-RT/bd-p/imxrt. Best regards |
Beta Was this translation helpful? Give feedback.
-
Hi @ofirshe , It seems to me that you do not have hardware available to confirm this yet. But you could test this with an EVK board. The EVK does not have multiple memory devices connected to the other chip selects. But you can still test the code to access the other chip select, and monitor the chip select pin to confirm the FlexSPI drives it. Best regards |
Beta Was this translation helpful? Give feedback.
-
Following up on this topic to make others aware, this pull request #72528 was merged, which adds multiple memory support on a single FlexSPI. Best regards |
Beta Was this translation helpful? Give feedback.
-
Hi @DerekSnell, In the final plan, we will have three
My question is: Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @ofirshe ,
The FlexSPI hardware will assert the chip select to the 3rd flash device based on the address requested, and the memory map you created with the flash sizes in the devicetree.
It seems to me that you do not have hardware available to confirm this yet. But you could test this with an EVK board. The EVK does not have multiple memory devices connected to the other chip selects. But you can still test the code to access the other chip select, and monitor the chip select pin to confirm the FlexSPI drives it. Best regards