SD card fwrite large file issue
Posted: 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)
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)