This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F2837xD\v190\F2837xD_examples_Cpu1\sd_card例程问题



当对官方例程调试时,SD卡调试过程中,对SD卡内的txt文件读是ok的,但加入写SD卡函数f_write时,不能写入数据,并且导致再次读数据也发生错误,请问fatfs系统的写函数是否可用????请大家帮忙看看问题出在哪!!!

以下是写函数代码:

Cmd_send_data(int argc, char *argv[])
{

FRESULT res=FR_OK;
WORD br;
FIL fsrc;

char textFileBuffer[] = "123456789";//{0x12,0x13,0x14,0x15,0x16};

char m[]="0:/fat.txt";


strcpy(g_cTmpBuf, m)

res = f_open( &fsrc , g_cTmpBuf , FA_CREATE_ALWAYS | FA_WRITE);//FA_CREATE_NEW | FA_WRITE);

if ( res == FR_OK )
{
/* Write buffer to file */
res = f_write(&fsrc, textFileBuffer, sizeof(textFileBuffer), &br);

if( res == FR_OK )
{
UARTprintf("hello word!");
}

/*close file */
f_close(&fsrc);


return(0);
}