kiwih / cubeide-sd-card

CubeIDE/CubeMX compatible MMC/SD memory card FatFs driver
Other
97 stars 56 forks source link

Improve writing throughput #20

Closed TheTarados closed 11 months ago

TheTarados commented 12 months ago

Fix #19 : use the Transmit Hal instead of calling TransmitReceive in a loop.

I have a tested that it does improve throughput. Something equivalent could be done to the rcvr_spi_multi by doing something like memset(buff, 0xFF, btr); HAL_SPI_Receive(&SD_SPI_HANDLE, (BYTE*)buff, btr, 100);. I tested it and it does not break the software. I think it should improve throughput on read but I did not verify it. I might do a benchmark at a later point and do another pull request if results show an improvement.

kiwih commented 11 months ago

Instead of a timeout of 100ms, can you set no timeout? HAL_MAX_DELAY? That would preserve the original behaviour which also has no timeout

Padifu03 commented 11 months ago

I have done a little test and it seems to work. It would be nice if we do a benchmark to ensure that. Furthermore, I will try to include the DMA through SPI and test it.