Skip to main content
Apill
Associate III
December 11, 2018
Solved

How can I improve the speed of sdio mode 1 bit and 4 bit ?

  • December 11, 2018
  • 5 replies
  • 1278 views

I need to store atleast 20,000 samples per second to perform FFT. so I have used memory card to store all the values in sd card. currently, I could only able to store 7000 samples at a particular interval of time but not more than that. I tried with one bit sdio mode and 4 bit but of no avail.

Any hints or tips to improve the speed of sdio mode? I also tried to increase the overall frequency of the clock then too it didnt affect the performance of sdio.

in the code for my trail purpose i simply created an array. In future I will store values from ADC inputs in array. when i change the value in array to 8000 and value in for loop to 7999 nothing happens! I could only able to create a .txt file in sd card but i cannot store values.

simple code:

uint16_t array[7000],j=1;

 /* USER CODE BEGIN 2 */

if(f_mount(&myFatFS, SDPath,1) == FR_OK)

{

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, GPIO_PIN_SET);

char myFILEName[]="TEST1.txt";

if(f_open(&myFILE, myFILEName, FA_WRITE| FA_CREATE_ALWAYS) == FR_OK)

{

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, GPIO_PIN_SET);

for(int i=0; i<=6999; i++)

 {

array[i]=j;

j++;

 }

if(f_write(&myFILE, array, sizeof(array), &myBytes)==FR_OK)

  {

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, GPIO_PIN_SET);

    }

f_close(&myFILE);

}

}

This topic has been closed for replies.
Best answer by Apill

Thanks for the inputs yes, there is a bug i found it! I declared local variable array for some reason it might be storing less amount of bytes when i declared globally it increased the total number of numbers to maximum space of microcontroller flash memory.

5 replies

Tesla DeLorean
Guru
December 11, 2018

>> I could only able to create a .txt file in sd card but i cannot store values.

Variables store in binary are not going to display nicely in ASCII via TYPE or CAT type commands, or loading into a text editor.

Look at the data in a File Viewer or Hex Editor

Opening/Closing a file repeatedly will be slow.

The file system and card want stuff in powers of two, ie writes of 8192 bytes or 32768 bytes for instance.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
December 11, 2018

File will contain bytes 01 00 02 00 03 00 04 00 ...

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..