SD card interface high speed mode

Milad_f1
Posts: 3
Joined: Tue Sep 11, 2018 9:38 am

Re: SD card interface high speed mode

Postby Milad_f1 » Wed Oct 03, 2018 2:38 am

Hi, I am working with wrover dev kit and use fwrite and fread to write and read a block of data into/from a .DAT file in the SD card. I increased the buffer size to 32kB which is the cluster size of my SD card. The write speed of 6MB and read speed of 1MB was achieved. Does anyone know how I can increase the reading speed from the SD card? Thank!
Here is a part of my code:

Code: Select all

#define FILE_SIZE 1048576 * 2	//2MB
#define BUF_SIZE 512 * 64		//32kB
uint8_t buf[BUF_SIZE];
... 
    FILE* f = fopen("/sdcard/hello.DAT", "w");
    uint32_t n = FILE_SIZE/sizeof(buf);     //= number of clusters
    for (uint32_t i = 0; i < n; i++) {
        fwrite(buf, sizeof(uint8_t), sizeof(buf), f);     
    }
    fclose(f);
    
    f = fopen("/sdcard/hello.DAT", "r");     
    for (uint32_t i = 0; i < n; i++) {
        fread (buf, sizeof(uint8_t), sizeof(buf), f);   
    }    
    fclose(f);

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: SD card interface high speed mode

Postby snahmad75 » Thu Feb 07, 2019 9:25 pm

I have same issue. read speed is slow.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: SD card interface high speed mode

Postby snahmad75 » Fri Feb 15, 2019 6:47 pm

Can some one reply and share your experience.

Why big heap memory allocation when read files using SD card interface. Can we avoid it. Can some one point me out line of which allocate this heap. I am hoping to use stack and read file chunk by chunk.

Who is online

Users browsing this forum: Google [Bot] and 118 guests