Using External NOR Flash SPI as SFFS

Hi,
I am using EC200UCNAA with SDK Version LTE01R03A02. I want to mount S25FL256SAG External NOR Flash using SPI as external NOR SFFS. To do so I have been referring to the “spi4_ext_nor_sffs_demo.c” demo file. For the time being, I am only attempting to mount the flash and create the “EXNSFFS:” file system using mkfs.

I have selected SPI port 2 and initialized SPI with “ql_spi_nor_init_ext(nor_config);” using the following config:

nor_config.port = QL_CUR_SPI_PORT;    // (QL_SPI_PORT2)
nor_config.spiclk = QL_SPI_CLK_25MHZ;
nor_config.input_sel = QL_SPI_DI_1;
nor_config.transmode = QL_SPI_DIRECT_POLLING;
nor_config.cs = QL_SPI_CS0;

I am able to confirm that SPI has been initialized correctly as I am able to fire commands to the external flash as well as read and write data using “ql_spi_nor_read();” and “ql_spi_nor_write();

When using “ql_spi4_ext_nor_sffs_set_port(QL_CUR_SPI_PORT);”, this function returns ‘1’, so it has selected port 2 successfully.
But when using “ql_spi4_ext_nor_sffs_mount();”, it is returning err code -2096889756 (QL_SPI4_EXT_NOR_SFFS_NOT_INIT_ERROR)
Next since mount does not return success, it proceeds to format and mkfs. Here, the device enters CP PANIC and the program shuts down abruptly.

In addition to this, I have made the following changes to support spi4_sffs:

  1. components\bootloader\src\boot_fdl_dnld.c
    Enabled code block for “CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_EXTNSFFS”
  2. components\ql-kernel\drivers\quec_spi_nor_flash_prop.c
    Added flash info data structure for S25FL256SAG
// S25FL256SAG
        .mid = 0x190201,
        .capacity = 0x2000000,
        .mode = QUEC_NOR_FLASH_MODE_8BIT,
        .mount_start_addr = 0x0000000,
        .mount_size = 0x2000000,
        .pb_size = 0x400,
  1. components\ql-config\build\EC200UCN_AA\8915DM_cat1_open\target.config
    Added following config
#SPI4 NOR FS
CONFIG_QUEC_PROJECT_FEATURE_SPI4_EXT_NOR_SFFS=y
CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR=n
CONFIG_QUEC_PROJECT_FEATURE_SPI_NOR_FLASH=y
#BOOT SPI4 NOR
CONFIG_QUEC_PROJECT_FEATURE_BOOT_SPI4_EXTNSFFS=y

I have two questions:

  1. Why does mount show QL_SPI4_EXT_NOR_SFFS_NOT_INIT_ERROR?
    Please check the nor_config and config changes shared above and let me know if I am missing something.
  2. Why does the device enter CP PANIC after mkfs?
    I am currently assuming since mount is showing the INIT_ERROR, it is unable to detect the external flash. Please let me know if there is any other reason.

Also, it would be a huge help if you could share the API reference manual for SFFS and any other related documents.

Thanks.

Hi,
Waiting for your valued response.

Hi,@Mahesh123

Why does mount show QL_SPI4_EXT_NOR_SFFS_NOT_INIT_ERROR?

1.Please try to enable the macro control for QUEC_PROJECT_FEATURE_SPI4_EXT_NOR_SFFS and disable the macro control for QUEC_PROJECT_FEATURE_SPI6_EXT_NOR in the"/components/ql-kernel/Kconfig"file.
image
image
2.Enable the demo in ql_init.c.
image
3.Configure the SPI port in spi4_ext_nor_sffs_demo.c.


4. quec_spi_nor_flash_prop.c configures the flash parameters, including the start address for mounting the file system and the size of the mounted space.

Why does the device enter CP PANIC after mkfs?

In spi4_ext_nor_sffs_demo.c, enable the corresponding code to remove write protection.
Select based on whether the mode parameter in the quec_spi_nor_flash_prop.c file from the previous step is 8-bit or 16-bit.

I hope the above information can be helpful to you.