Our custom target h/w has a 2nd serial flash connected to FLEXSPI2_A port, this is intended to be used for the storage of non volatile data. Note, this is NOT the same device that is used to boot the chip or XIP (which is connected to FLEXSPI_A)
Please can you point me at some SDK examples that support erase, program and read from FLEXSPI_2 in our application? I think it might be possible using AHB commands or IP commands, also there might be existing drivers for this?
The implementation that you are trying to achieve is possible. We don't have an example that demonstrates explicitly how to do this. This is because the projects that we provide within the SDK are limited to the hardware that is available in our EVK. Our evaluation board has only one external flash connected through the FlexSPI interface. However, we do provide an example that demonstrates how to use part of the external flash as NVM. This is a great starting point for your application. You will find the drivers and how to initialize the memory. You only need to adapt this project to your custom needs. For example, change FlexSPI to FlexSPI2, change the LUT, change the size of the memory, etc. Also, in the SDK example, we copy all the functions that interact with the external flash to the internal flash. This is done because you cannot write, erase and read the external flash while doing XiP. In your case, this won't be necessary since you will have two different memories connected through different FlexSPI interfaces. The name of the SDK example project is flexspi_nor_polling_transfer.