I found a problem when I use CMD25 to write data into the SD card and write to the end of the storage. There will be a wrong state which can't accept command problem. I found there may be some codes written wrong in sd.c
sd->data_start += sd->blk_len; //data_start has added blk_len if (sd->data_start + sd->blk_len > sd->size) { //so it should not be added again when checking sd->size