fatfs SD卡读数据,txt文件内数据量较大后卡死在f_read处
代码为:
FIL fileobj;
FRESULT fr;
UINT brs;
u8 file_buff[]={0};
void file_open(u8 * file_path)
{
u32 size=0;
fr=f_open(&fileobj,(const TCHAR*)file_path,FA_READ|FA_WRITE);
if(fr==FR_OK)
{
size=f_size(&fileobj);
printf("%d",size);
f_read(&fileobj,file_buff,size,&brs);
}
f_close(&fileobj);
printf("%s",file_buff);
}
数据量较多时XCOM接收size数值为3032 随后卡死。
数据量较少时XCOM接收为 3260X6Dr1X19,0X75,0X18,0X65,0X18,0X65,0X59,0X6D,0X59,0X65,0X19,0X6D,0X39,0X75,0X59,
0X64,0XD8,0X64,0XD8,0X6C,0XF9,0X75,0X19,0X74,0XF8,0X6C,0X96,0X74,0XD7,0X8D,0X79,
0X5C,0X13,0X64,0X55,0X6C,0XB6,0X64,0X76,0X5C,0X35,0X8D,0X59,0X74,0X95,0X85,0X38,
0X84,0XF7,0X5B,0X92,0X8D,0X17,0X84,0XD6,0X64,0X13,0X95,0X99,0X95,0X79,0X8D,0X79,? (部分乱码)(size值为326)
求解
一周热门 更多>