Doubts about writing in SD card.

I�m working in a datalogger, and my question is: Is there a problem to write a lot of single bytes via fat_Write(), or I must employ a intermediary buffer for this task? Can This method be dangerous to the SD? Using a buffer may improve data throughput?
Regards, Alfredo.

Alfredo,
The FAT has an underlying write-thru cache which will handle the single byte writes very well assuming you aren’t dealing with a lot of other files at the same time. If you’re just working with the one log file, you have no problem. The cache layer will cache the current last sector of the file and will hold in battery backed RAM until it needs to write it out. The battery backed RAM has fail safe features to protect your data even if power is lost. The one thing you do need to make sure of is that before you intentionally take the system down or ready to remove a card, that you either sync the partition, or unmount the entire device. This ensures that any unwritten data that is still in the battery backed memory gets written to the SD card.

If you are working with many files, you may want to do your own cache of single byte writes, as if you switch back and forth between many files, the cache system must write dirty sectors to the device much more frequently.

The same problem of me.
The answer is the same for a nand flash memory device? (I got a rcm4000 with 32m nand flash).
I need to write single packets 13 bytes longs, and i am afraid this can damage the device
The documentation says “In all versions of the FAT, a battery-backed write-back cache reduces wear on the flash device and a round-robin cluster assignment helps spread the wear over its surface”, then there is either a write-through cache, and a write-back cache(at different levels maybe)?
TIA!!

That was a slip on my part, it is a write-back cache. It is used on all flash types so it will help with NAND flash as well. For best wear protection, try to limit the number of files you open. The fewer files you have open, the less the cache will need to write to the flash before you’re completely done with a cluster. This way you’re working mainly with battery-backed memory. The cache has a power loss recovery feature that will recover cached data even after an interruption in power. Remember, a battery for memory is required for power loss protection.

Thanks a lot bsprouse for your advices!!
My application use max two files at a time, one for continuous logging, and one for reading the logging from the remote pc on request.
The board is equipped with battery, thanks!!
Saverio