Trouble with FileX in SSP 1.2.0

I recently upgraded my software on S7G2-DK from SSP 1.1.3 to SSP 1.2.0, and I'm still having trouble with FileX on sdmmc. (Whereas with old SSP 1.1.3 all works fine). Issue description:
High level function call that is failing, returning with FX_IO_ERROR:
    uint32_t fx_ret_val;

    fx_ret_val = fx_media_open(&g_fx_media, "g_fx_media", SF_EL_FX_BlockDriver,
          &g_sf_el_fx_cfg, g_media_memory_g_fx_media,
          sizeof(g_media_memory_g_fx_media));
          
Low level function call that is failing, returning false:
    scr_get(p_ctrl);
    
After the above function is failing, no communication is possible with the SD card.

This problem is not related specifically to the ACMD51 (send scr command), but rather to any command which asks the card to send some data on the DAT lines. Simple commands (command written on CMD line, response received on CMD line) are working

I paste my FileX configuration, sdmmc configuration and the call stack when I fall into the issue.

.

Regards.

  • In reply to Renesas Karol:

    Thank you , I managed to access the SD Card.
    Regards,

    isaenz.
  • In reply to isaenz:

    Hello again  

    I'm making some tests with the SD card and I manage to create files and folders, but when I try to check them on the PC with a card reader, the files/folders seems to be corrupted.

    When I read the file inside the application everything seems to be ok (it reads the written text).

    Here's the code I'm using:

    static FX_FILE g_file;

    #define MAX_BYTES 100
    static CHAR g_read_buffer[MAX_BYTES];

    /* SD Thread entry function */
    void sd_thread_entry(void)
    {
        UINT res;
        ULONG read_size;

        /* Directory name */
        CHAR dir_name[] = "test_dir";

        /* File name */
        CHAR file_name[] = "abc.txt";
        // CHAR file_name[] = "test_dir/abc.txt";

        res = fx_file_delete(&g_fx_media, file_name);

        if (((uint8_t)FX_SUCCESS != res) &&((uint8_t)FX_NOT_FOUND != res))
        {
            __BKPT(0);
        }

        res = fx_directory_create(&g_fx_media, dir_name);

        if ((uint8_t)FX_SUCCESS != res && (uint8_t)FX_ALREADY_CREATED != res)
        {
            __BKPT(0);
        }

        /* Create a file */
        res = fx_file_create(&g_fx_media, file_name);

        if ((uint8_t)FX_SUCCESS != res && (uint8_t)FX_ALREADY_CREATED != res)
        {
            __BKPT(0);
        }

        res = fx_file_open(&g_fx_media, &g_file, file_name, FX_OPEN_FOR_WRITE);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        res = fx_file_truncate(&g_file, 0u);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        res = fx_file_write(&g_file, "This is a test.", 15);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        /* Close the file */
        res = fx_file_close(&g_file);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        tx_thread_sleep(100);

        /* Open the file for read */
        res = fx_file_open(&g_fx_media, &g_file, file_name, FX_OPEN_FOR_READ);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        /* Read the file */
        res = fx_file_read(&g_file, g_read_buffer, MAX_BYTES, &read_size);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }

        g_read_buffer[read_size] = '\0';

        /* Close the file */
        res = fx_file_close(&g_file);

        if ((uint8_t)FX_SUCCESS != res)
        {
            __BKPT(0);
        }


        while(1)
        {
            tx_thread_sleep(50);
        }
    }

    Can you think about a way to solve this?

    Regards,

    isaenz.

  • In reply to isaenz:

    Hello isaenz,

    Please make sure you call fx_media_flush(p_media) before removing the SD card.

    Regards
  • In reply to Renesas Karol:

    That was it! Thanks