This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why can't I read data greater than 8kb from the sd card?

int t=0;
int snd=0;
int ok=0;
   fr = f_open(&file, "file.TXT", FA_READ);

            if (fr == FR_OK){
                NRF_LOG_INFO("File Open!");     
                ok=1;
           }
                size= f_size(&file);
                char * data=NULL;

                data = malloc(size); 
                NRF_LOG_INFO("file size: %d", size);
  
                    while(ok==1){
          
                    NRF_LOG_INFO("File Read!");
                
                  while(t<=size){
                  fr = f_read(&file, data, 256, (UINT *) &bytesRead);
                   NRF_LOG_INFO("%d", bytesRead);
                   nrf_delay_ms(5);
                    for (int i=0;i<256;i++)
                    {   
                     printf("%c",data[i]);
                   }
                   if(t<=size){
                     t+=256;    
                     }            
                     }
                     break;  } 
                     bytesRead=0;
                     t=0;
                    f_close(&file); 

Parents Reply Children
No Data
Related