Hi Folks,
I did a small example in order to validate FatFS in my applicaiton. The environment is looks like:
- FreeRTOS 7.x
- FatFs
- SD card with Fat32 file system, 512 byte allocation size
- SD card accessed via SPI
- both of them are coming from the TI provided TivaWare
Here is the example code, right after the main():
static uint32_t dummy[512]; static libs::Storage storage("test", FA_CREATE_ALWAYS | FA_WRITE); for (uint32_t cycle = 0; cycle < 40000; ++cycle) { for (uint32_t index = 0; index < 512; ++index) { dummy[index] = index; } if (storage.write(reinterpret_cast<uint8_t*>(dummy), 2048) == 0) { break; } } storage.close();
The Storage class is a thin wrapper aroung the FatFS API, so you can suppose that the API call is directly in place.
My problem is that this example seems to work correctly, if the "dummy" is equal (even less) to the allocation size of the SD card, but in the case above, I got "FR_INT_ERR" from remove_chain() in ff.c:
while (clst < fs->n_fatent) { /* Not a last link? */ nxt = get_fat(fs, clst); /* Get cluster status */ if (nxt == 0) break; /* Empty cluster? */ if (nxt == 1) { res = FR_INT_ERR; break; } /* Internal error? */ if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
Can anybody help me, what did I wrong?
Regards,
Norbert