AnsweredAssumed Answered

FAT16 faster than FAT32? VDSP 5.0 Update 10.0

Question asked by dmann on Dec 9, 2011
Latest reply on Feb 8, 2012 by MartinK

Martin,

 

Im working on the BF525 w/ _BF527_SDRAM_ISSUE_WORKAROUND undefined. I've made some of the changes you referred to in thread: http://ez.analog.com/message/37711#37711

 

Moving the FSS Cache does not seems to provide a very significant improvement in write performance. I did notice that if the media is formatted in FAT16 vs FAT32 the performance is much better. Here's some example tests of media

 

Test: Write 512KB to media in using various fwrite() payloads. (I've tested adi_fss_ API to open/write/close with poorer performance, so chosen to use C I/O).

 

 

Format
32B
64B128B256B
512B1024B2048B
Generic 678MB - FAT161.41 MB/S0.80 MB/S1.48 MB/S1.49 MB/S1.51 MB/S0.84 MB/S0.85 MB/S
Generic 678MB - FAT320.51 MB/S0.74 MB/S0.74 MB/S0.75 MB/S0.75 MB/S0.54 MB/S0.54 MB/S

 

 

Also i've noticed huge improvements by undefining the _USE_BACKG_XFER define in the adi_usb.c ($Revision: 3459 $) for some media Example:

 

Format32B64B128B256B512B1024B2048B
Generic - 2GB FAT16  _USE_BACKG_XFER undefined6.12 MB/S7.35 MB/S7.98 MB/S8.33 MB/S9.03 MB/S10.30 MB/S12.85 MB/S
Generic - 2GB FAT16  _USE_BACKG_XFER defined1.17 MB/S0.42 MB/S1.23 MB/S1.23 MB/S1.10 MB/S1.09 MB/S1.10 MB/S

but some slower media actually performs worse with this undefined. I was wondering if you had any advice on a procedure to determine the best settings for a particular connected USB device. Could you outline a generic procedure for using the information provided by the device to set up the fss/fsd for optimal settings? How might these settings change for a FAT16 device or FAT32 device with a certain number of clusters?

 

Should the cache be set to safe values like:

{ ADI_FSS_CMD_SET_NUMBER_CACHE_BLOCKS,      (void*)2 },
 { ADI_FSS_CMD_SET_NUMBER_CACHE_SUB_BLOCKS,  (void*)1 },

 

and then be changed one to media device has given back it's number of clusters? For example, if the media device returns that it has 64 clusters, should I reset the cache to:

{ ADI_FSS_CMD_SET_NUMBER_CACHE_SUB_BLOCKS,  (void*)64 },

 

If so, do i need to terminate the fss and re-init?

 

Right now my fss init looks like:

 

void InitFileSystem(void) 
{
       
    /*******************************************************************
    * Customized heaps for General, fat and atapi 'cache' type data
    *******************************************************************/
    int GeneralHeapID   = heap_lookup(1);
    //int CacheHeap = heap_lookup(2);
 
    /*******************************************************************
    * command table for the FAT driver
    *******************************************************************/
    static ADI_DEV_CMD_VALUE_PAIR ADI_FAT_ConfigTable [] = {
            { ADI_FAT_CMD_ENABLE_USAGE_STATS, (void*)true },
            //{ ADI_FSS_CMD_SET_CACHE_HEAP_ID,   (void*)0 },
            { ADI_DEV_CMD_END,                 NULL     },
    };

    /*******************************************************************
    * definition structure for FAT driver - exported to application
    *******************************************************************/
    static ADI_FSS_DEVICE_DEF ADI_FAT_Def = {
        0,                                      /* N/A for FSD drivers                    */
        &ADI_FAT_EntryPoint,                    /* Entry Points for FAT Driver            */
        ADI_FAT_ConfigTable,                    /* Command Table to configure FAT driver  */
        NULL,                                   /* Critical region data                   */
        ADI_DEV_DIRECTION_BIDIRECTIONAL,        /* Direction (RW file system)             */
        NULL
    };


    
    /*******************************************************************
    * Configuration table to initialize the FSS
    *******************************************************************/
    ADI_FSS_CMD_VALUE_PAIR adi_fss_Config[] = {
        /* Personalized Memory Allocation Routines */
    #if defined(_DEBUG_ALLOC_)
        { ADI_FSS_CMD_SET_MALLOC_FUNC,      (void*)_adi_dbg_malloc },
        { ADI_FSS_CMD_SET_REALLOC_FUNC,     (void*)_adi_dbg_realloc },
        { ADI_FSS_CMD_SET_FREE_FUNC,        (void*)_adi_dbg_free },
    #endif
        { ADI_FSS_CMD_SET_NUMBER_CACHE_BLOCKS,      (void*)2 },
        { ADI_FSS_CMD_SET_NUMBER_CACHE_SUB_BLOCKS,  (void*)1 },
        { ADI_FSS_CMD_SET_GENERAL_HEAP_ID,          (void*)GeneralHeapID },
        //{ ADI_FSS_CMD_SET_CACHE_HEAP_ID,          (void*)CacheHeap },
        { ADI_FSS_CMD_SET_MEDIA_CHANGE_CALLBACK, (void*)USBMediaDetectCallback },
        
        /* Add Media Devices - one command per type of Media Device Present */
        
           { ADI_FSS_CMD_ADD_DRIVER,           (void*)&ADI_USB_Def },
        //{ ADI_FSS_CMD_ADD_DRIVER,           (void*)&ADI_NAND_Def },
       
        /* Add File Systems - one command per type of File System Present */
        { ADI_FSS_CMD_ADD_DRIVER,           (void*)&ADI_FAT_Def },
        
        /* DMA and Device Manager Handles */
        { ADI_FSS_CMD_SET_DMA_MGR_HANDLE,   (void*)adi_dma_ManagerHandle },
        { ADI_FSS_CMD_SET_DEV_MGR_HANDLE,   (void*)adi_dev_ManagerHandle },
        { ADI_FSS_CMD_SET_DCB_MGR_HANDLE,   (void*)adi_dcb_QueueHandle },
        
        /* Command Table Terminator */
        { ADI_FSS_CMD_END, (void*)NULL }
    };
    
    /* Initialize the file system service */
    adi_fss_Init ( adi_fss_Config );
    
    /* Add to CRT device table - which will make it the default */
    add_devtab_entry( &adi_fss_entry );
}

Outcomes