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: Select all
#define LS_WRITE_BUF_SIZE 128
size_t LFile::write(uint8_t v)
if(!_fd || _isDir)
_buf[_bufPos++] = v;
if(_bufPos == LS_WRITE_BUF_SIZE)
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?