#define BUFFSIZE 10000
unsigned char textarray[BUFFSIZE];
result = SD_write(sdHandle, textarray, STARTINGSECTOR, sectors);
给sd写数据,这个BUFFSIZE 设置10000,程序报错,如何给sd卡写更多的数据
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.
#define BUFFSIZE 10000
unsigned char textarray[BUFFSIZE];
result = SD_write(sdHandle, textarray, STARTINGSECTOR, sectors);
给sd写数据,这个BUFFSIZE 设置10000,程序报错,如何给sd卡写更多的数据
在英文论坛寻給你建議了,不過你的問題似乎是一个外接传感器,一个外接sd卡共用spi導致的?
您好,
1.只用sdraw例程,如何给sd写入更多的数据,例程中unsigned char textarray[BUFFSIZE];数组只有1024,如何写入更多数据?
2.sd卡写入地址是哪函数
可以試試用SD_write的第三個參數去指定不同的sector去写入更多数据
result = SD_write(sdHandle, textarray, STARTINGSECTOR, sectors);
STARTINGSECTOR = 0,sectors=2;
您好,比如第一次写1024字节数据,占据2个扇区,第二次写1024字节数据,不覆盖第一次的数据
STARTINGSECTOR这个值需要怎么变化?
建議你整個讀出來,修改第二次要写的1024字节数据,然後在整個写入就好
第一次写1024字节数据,占据2个扇区,第二次写1024字节数据,不覆盖第一次的数据,第二次写STARTINGSECTOR这个值應該要改成2
只需要把STARTINGSECTOR递增2,我试了,写不进去,失败
#if (WRITEENABLE)
while(1)
{
for (i = 0; i < BUFFSIZE; i++)
{
textarray[i] = rand();
}
Display_printf(display, 0, 0, "Writing the array...\n");
result = SD_write(sdHandle, textarray, STARTINGSECTOR, sectors);
if (result != SD_STATUS_SUCCESS) {
Display_printf(display, 0, 0, "Error writing to the SD card\n");
while (1);
}
STARTINGSECTOR=STARTINGSECTOR+2;
if(sectors>492544)
{
break;
}
}
SD_initialize失败當然就寫不進去,你看看是不是又是腳位設置的問題吧,先解決SD_initialize失败的問題在說
之前运行的好好的,写了几次数据,突然初始化失败,
* Set this constant to 1 in order to write to the SD card.
* WARNING: Running this example with WRITEENABLE set to 1 will cause
* any filesystem present on the SD card to be corrupted!
是不是这个问题?
哪有什麼format例程,是請你把SD卡拿到你的PC去格式化后再試試看
沒用過ZDSD04GLGEAG這個芯片,你可能要找原廠支援,或是換個板子繼續測試
#if (WRITEENABLE)
while(1)
{
for (i = 0; i < BUFFSIZE; i++)
{
textarray[i] = rand();
}
Display_printf(display, 0, 0, "Writing the array...\n");
result = SD_write(sdHandle, textarray, STARTINGSECTOR, sectors);
if (result != SD_STATUS_SUCCESS) {
Display_printf(display, 0, 0, "Error writing to the SD card\n");
while (1);
}
STARTINGSECTOR=STARTINGSECTOR+2;
if(sectors>492544)
{
break;
}
程序这样写,每写1024字节,STARTINGSECTOR递增2,可以么
STARTINGSECTOR是個define,"STARTINGSECTOR=STARTINGSECTOR+2;"這樣的語法應該編譯不過吧,應該是要改成變數才行
/*!
* @brief Generic error status code returned by SD_control().
*
* SD_control() returns SD_STATUS_ERROR if the control code
* was not executed successfully.
*/
#define SD_STATUS_ERROR (-1)