Problem with Write SD card

When I use the API “Lfile.write()” to write a 512 bytes command to the interface file which stored on SD card, the COS(Chip OS) of SD card can only received the first 128 bytes.
I read the API, as follows, and then I got the reason:

[code]#define LS_WRITE_BUF_SIZE 128

size_t LFile::write(uint8_t v)
{
if(!_fd || _isDir)
return 0;

_buf[_bufPos++] = v;
if(_bufPos == LS_WRITE_BUF_SIZE)
    flush();
return 1;

}[/code]

The function flush the data after store 128 bytes in a buffer, I think the flush time takes too long, so that the COS regard it as the writing has been finshed. I try to change the macro to 512, but the function no longer work.

I do not know whether the size of 128 byte is determined by hardware or not? Is there some ways to write 512 bytes together without pause?

Hello,

The SDK (i.e API) is developed by MediaTek. Advanced Technical support on API/ SDK is available at MediaTek LinkIt One Forums.

Could you please use the following example as a reference to implement writing data to SD Card: SD example.

Thanks and Warm Regards.