cy_serial_flash_qspi_init failing

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ELA_2836231
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

hello,

i've succesfully tried and reproduced the example called "qspi_read_write_using_sfdp".

When i'm importing the rights function in my project, the init function fails (cy_serial_flash_qspi_init).

When i'm digging into the details, it fails when calling Cy_SMIF_MemInit which return CY_SMIF_SFDP_SS0_FAILED

i've compared everything, and i'm not able to find what i'm doing wrong.

 

is there anybody who experienced the same issue ? thanks

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello @ELA_2836231 ,

I have attached the modified project. Please import the project into Eclipse IDE.

After the project is successfully imported, copy and replace the file design.cyqspi file in the path: "mtb_shared\TARGET_CY8CPROTO-062-4343W\latest-v2.X\COMPONENT_BSP_DESIGN_MODUS"

Then run the QSPI configurator and click File > Save. This will generate the files in the GeneratedSource folder. 

Build the project and program your device. Let me know what you see in the terminal. 

Regards,
Dheeraj

 

View solution in original post

0 Likes
13 Replies
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Hello @ELA_2836231 ,

Can you please let me know the following:

  • The version of ModusToolbox being used
  • The kit you are using
  • The modifications you have done to the code example

The error CY_SMIF_SFDP_SS0_FAILED basically means it failed to initialize the memory slave 0 by auto-detection (SFDP). 

Looking forward to your reply. Please attach the project if possible so that we can look into what's going wrong. 

Regards,
Dheeraj

0 Likes

Hello @DheerajK_81 

thanks for your support

  • Modus version : 2.2
  • kit i'm using : CY8CPROTO-062-4343W
  • Modification i've done in the example : 
    • i've copied mem_config_sfdp.c & mem_config_sfdp.h in my project (no modifications)
    • my project is based on the ANYCLOUD_MQTT_CLIENT example (i use it as a fundation for my project), therefore using WIFI. That's a difference compared to qspi_read_write_using_sfdp example.
    • i'm not calling cy_serial_flash_qspi_ini(..) from the main file but from storage_management.c and the initialisation code is provided bellow. This function is called after the BSP initialisation exactly like in the SDFP example.

 

 

#include "mem_config_sfdp.h"
#include "cyhal.h"
#include "cybsp.h"
#include "cy_retarget_io.h"
#include "cy_serial_flash_qspi.h"
#include "storage_management.h"
#include "string.h"
#include <stdlib.h>     /* atoi */

uint32_t nonvolatile_memory_init(void)
{
	cy_rslt_t result;
	uint8_t read_signature[PACKET_SIZE];

        uint32_t ext_mem_address = 0x00;
        size_t sectorSize;

	printf("[event]Emulated EEPROM init  \r\n");

	memset(read_signature,0,SIGNATURE_SIZE);

	result = cy_serial_flash_qspi_init(smifMemConfigsSfdp[MEM_SLOT_NUM], CYBSP_QSPI_D0,
	              CYBSP_QSPI_D1, CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, NC, NC,
	              CYBSP_QSPI_SCK, CYBSP_QSPI_SS, QSPI_BUS_FREQUENCY_HZ);
	
    check_status("Serial Flash initialization failed", result);
}

 

 

 

 

many thanks for your support, looking forward for guidance

best regards, ELA

0 Likes

Good morning @DheerajK_81 

i would like to elaborate more. Always in the ANYCLOUD MQTT CLIENT example, i've merged the other QSPI example (QSPI_Flash_Read_Write), this time it isn't with SFDP functionality.

The QSPI_Flash_Read_Write is working alone. When this example is merged into my code : i'm running in other troubles. i'm copying the console output

Total Flash Size: 67108864 bytes

1. Erasing 262144 bytes of memory

Total Flash Size: 67108864 bytes

1. Erasing 262144 bytes of memory

2. Reading after Erase and verifying that each byte is 0xFF

=============================================================================
FAIL: Reading memory failed
Error Code: 0x00B20002
=============================================================================

The read function is sending a timeout error when reading.

I don't know if the FREERTOS or WIFI option is causing issues. 

I've the same Flash library and same BSP as the QSPI_Flash_Read_Write example.

thank you for your support, it is greatly appreciated.

0 Likes

Hello @ELA_2836231,

I'm able to reproduce this issue. The memory initialization seems to fail when used in MQTT Client Application. 

I'm calling it in the main function before the scheduler runs. Are you calling the APIs from a task or directly from main?

Regards,
Dheeraj

0 Likes

hello @DheerajK_81 

it is the same for me, calling before the scheduler runs just after 

cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX,
CY_RETARGET_IO_BAUDRATE);

thanks for your help.

best regards

Etienne

0 Likes
lock attach
Attachments are accessible only for community members.

Hello @ELA_2836231 ,

The SFDP Auto Detect didn't seem to be working. I changed the configuration to use the memory chip instead in the file design .cyqspi as shown in the figure attached.
 smif.PNG

The design.cyqspi file will be located at this path: "mtb_shared\TARGET_CY8CPROTO-062-4343W\latest-v2.X\COMPONENT_BSP_DESIGN_MODUS\design.cyqspi".

Click the Save icon highlighted above to generate the files cycfg_qspi_memslot.c/h in the GeneratedSource folder. I deleted the mem_config folder which had the config files from the SFDP project. You don't need them.

In the init function do the following modification:
result = cy_serial_flash_qspi_init(smifMemConfigs[MEM_SLOT_NUM], CYBSP_QSPI_D0,
CYBSP_QSPI_D1, CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, NC, NC,
CYBSP_QSPI_SCK, CYBSP_QSPI_SS, QSPI_BUS_FREQUENCY_HZ);

After these changes, things worked perfectly. I will check how the Auto SFDP issue can be solved. But this should help you move forward 🙂

Regards,
Dheeraj

0 Likes

Hi @DheerajK_81 

many thanks, i've checked this option. The init pass then and i'm able to erase.

When i start the read memory and check if this well erased (0xFF), it fails (timeout).

i've copied the other example (read write, without sfdp).

cy_rslt_t result;
	    uint8_t tx_buf[PACKET_SIZE];
	    uint8_t rx_buf[PACKET_SIZE];
	    uint32_t ext_mem_address = 0x00;
	    size_t sectorSize;

    result = cy_serial_flash_qspi_init(smifMemConfigs[MEM_SLOT_NUM], CYBSP_QSPI_D0,
              CYBSP_QSPI_D1, CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, NC, NC,
              CYBSP_QSPI_SCK, CYBSP_QSPI_SS, QSPI_BUS_FREQUENCY_HZ);
    check_status("Serial Flash initialization failed", result);

    sectorSize = cy_serial_flash_qspi_get_erase_size(ext_mem_address);
    printf("\r\nTotal Flash Size: %u bytes\r\n", cy_serial_flash_qspi_get_size());

    /* Erase before write */
    printf("\r\n1. Erasing %u bytes of memory\r\n", sectorSize);
    result = cy_serial_flash_qspi_erase(ext_mem_address, sectorSize);
    check_status("Erasing memory failed", result);

    /* Read after Erase to confirm that all data is 0xFF */
    printf("\r\n2. Reading after Erase and verifying that each byte is 0xFF\r\n");
    result = cy_serial_flash_qspi_read(ext_mem_address, PACKET_SIZE, rx_buf);
    check_status("Reading memory failed", result);

 thanks

0 Likes

Can you attach the cycfg_qspi_memslot.c/h files? I was able to get things working with this option, so probably some setting might be wrong in your case. 

Regards,
Dheeraj

0 Likes
lock attach
Attachments are accessible only for community members.

@DheerajK_81 

for sure, here we go. thanks a lot

0 Likes

Hello @ELA_2836231 ,

Checked the files, I have the same settings. Can you add a delay between the erase and read functions in this manner:

result = cy_serial_flash_qspi_erase(ext_mem_address, sectorSize);
check_status("Erasing memory failed", result);

Cy_SysLib_Delay(500);

Let me know if it works with this change.

Regards,
Dheeraj

0 Likes

hello @DheerajK_81 

i've tried, even increased to 1000 but without success.

best regards

0 Likes
lock attach
Attachments are accessible only for community members.

Hello @ELA_2836231 ,

I have attached the modified project. Please import the project into Eclipse IDE.

After the project is successfully imported, copy and replace the file design.cyqspi file in the path: "mtb_shared\TARGET_CY8CPROTO-062-4343W\latest-v2.X\COMPONENT_BSP_DESIGN_MODUS"

Then run the QSPI configurator and click File > Save. This will generate the files in the GeneratedSource folder. 

Build the project and program your device. Let me know what you see in the terminal. 

Regards,
Dheeraj

 

0 Likes
ELA_2836231
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

hello, 

any though on potential idea for check are welcome ! i'm still struggling with this issue and not finding any way to understand what's going wrong. 

many thanks !

0 Likes