SD card fwrite large file issue

rma-31
Posts: 15
Joined: Sun Oct 08, 2017 5:07 pm

SD card fwrite large file issue

Postby rma-31 » Sun Oct 08, 2017 5:10 pm

When using fwrite on SD card write fails once file approaches 1Mbyte size, anyone has an idea?
edit: I used SPI mode, today I checked the clock line, it seems that some blocks are transferred but eventually the transaction brakes down, possibly a DMA issue?


char * buf= malloc(1024);
bzero(buf, 1024);
(*buf) = 'C';
for(int i = 0; i<1024;i++){
ESP_LOGI(TAG, "Writing block %d", i);
fwrite(buf, 1, 1024, f);
}
free(buf);
fclose(f);
Error:
I (4902) example: Writing block 1022
I (4902) example: Writing block 1023
E (5032) sdspi_host: sdspi_host_start_command: cmd=24 error=0x107
E (5032) sdmmc_cmd: sdmmc_write_sectors_dma: sdmmc_send_cmd returned 0x107
E (5032) diskio_sdmmc: sdmmc_write_blocks failed (263)
Last edited by rma-31 on Tue Oct 10, 2017 8:21 pm, edited 1 time in total.

rma-31
Posts: 15
Joined: Sun Oct 08, 2017 5:07 pm

Re: SD card fwrite large file issue

Postby rma-31 » Tue Oct 10, 2017 8:12 pm

The test above has been carried out with SPI mode.
Looking on the clk line it seems that the transaction eventually brakes down after a while, actually earlier than the reported 1023 blocks.

Am really puzzled, no clue what is happening, any help much appreciated;)

Who is online

Users browsing this forum: No registered users and 97 guests