Skip to main content
Visitor II
December 3, 2024
Question

How to improve sd card read speeds for f_read using SPI signals

  • December 3, 2024
  • 0 replies
  • 653 views

I am using a user defined diskio function (found online here https://github.com/kiwih/cubeide-sd-card/tree/master/cubeide-sd-card/FATFS/Target) for doing read and writes using SPI2. I am trying to read 50,000 floats from a file that containsway more than that. My SPI baudrate is setup at 48 Mbits/s(SPI clock at 96 with prescalar divided by 2) and attaching the spi signals to a oscilloscope does show that the clock speed and the data speed is correct. However,

f_read(&file, arr_floats, 50000* 4, &bytesread);

takes over 7 seconds to read all the bytes when at 48Mhz it should be reading it in way less than a second. I am using a LEXAR 32gb V10 sdcard in FAT32 format, and was wondering what I could do to increase the read speed of the floats???

I have tried several different methods to improve it: reading 512 bytes at a time instead of the 50,000 * 4 at a time, I have tried to implement the dma, I have tried to use a different SDcard, but none of the things helped in increasing the speed by much.

Any help will be much appreciated. Thanks.

    This topic has been closed for replies.