AnsweredAssumed Answered

SD CARD data larger than 800 bytes write error

Question asked by khan.umair on Mar 13, 2015
Latest reply on Mar 13, 2015 by khan.umair
i am simply testing FATFS with my uSD card, whenever i write more than 800 bytes of hex data in card using f_write, it writes junk data, the hex file is attached, my code is shown below


#define size 1200


uint32_t buffer[size];


int main(void)
{
     int kk;
     init_GPIO();


     for (kk = 0; kk < size; kk++ )
     {
     buffer[kk] = 0x12345678; 
     }
     
     f_mount(0, &filesystem);
     f_open(&file, "DATA.YUV", FA_READ | FA_WRITE | FA_CREATE_ALWAYS);
          
     GPIOD->BSRRL = 0x1000; // this sets LED1 (green)  0x2000 0x4000 0x8000
          
     f_write(&file, &buffer[0] , size*4, &bw);
     if (bw<(size*4)) while(1);


     f_close(&file);
     f_mount(0, NULL);
     GPIOD->BSRRH = 0x1000;     
     GPIOD->BSRRL = 0x2000;
     while(1);
}

 
i am using HxD hex reader to read data,

Attachments

Outcomes