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.

FreeRTOS与SD卡的写入



SD卡采用FatFs文件系统,TI提供的库直接使用,如果不使用OS,可以正常写入

    static FIL fp_vol;
    char filename[20];
    char pBuffer[1024];
    int Size;

    int i,j;
    for(j=0;j<5;j++)
    {
        dvfNum++;
        sprintf(filename,"%d.wav",dvfNum);
        Report("\n\n\rWriting %s...\n\r",filename);
        res = f_open(&fp_vol,filename,FA_CREATE_ALWAYS|FA_WRITE);
        if(res == FR_OK)
        {
          for(i=0;i<2000;i++)//30000
          {
            res = f_write(&fp_vol,pBuffer,1024,&Size);
            if(res!=FR_OK||Size!=1024)
            {
                Report("Wrote : %d Bytes,%d",Size,i);
                break;
            }
          }
          res = f_close(&fp_vol);
        }
        else
        {
            Message("Failed to create a new file\n\r");
        }
        
        Report("Wrote : %d Bytes,%d",Size,i);
    }
    while(1);

连续写入5个1000K大小的文件,不管写多少次都可以正常写入;但是一旦用OS启动一个任务来进行写文件操作就无法写入成功。

利用osi_TaskDisable();来停止任务调度也不行,请教一下各位,如何在OS下正常使用FatFs进行文件读写!!麻烦各位!