Problems using f_stat, f_findfirst and f_tell
Posted: Wed Oct 18, 2017 10:22 am
I am getting a decimal 37 return code from each of the library functions f_tell, f_stat and f_findfirst. I don't know how to interpret the number. If it corresponds to:
"F_ERR_TASKNOTFOUND", // 37
I still don't know what that means despite its appearance in fwerr.h.
The big picture is that my code opens a file called "data.csv" on onboard mmc. In response to a trigger, the next text line is sent to UART 1. The idea is to inject CSV lines instead of barcode strings, which come in UART 0. That file is currently just sequential numbers in ASCII:
00000001
00000002
00000003
00000004
00000005
I can send 1, 2, 3, then login to ftp and run ls, which triggers this code. Then I can continue, injecting 4, 5, ..., even though the code below uses ftell and fseek to read the file size. This code is called from FTPD_GetFileSize:
The file read uses the same global file pointer, as long as it is not NULL.
f_tell returns 37 in both places. It returns 37 if I send a few lines and try again. f_stat and f_findfirst also return 37 with junk in the structures.
The fact that correct text lines are coming out when I trigger tells me that I am opening the mmc and the file correctly.
Can anyone give me a hint or example of the proper use of seek/tell or stat in Netburner EFFS? I am using chip 54415 with Netburner IDE 2.8.2 on Win10.
Thanks,
Larry
"F_ERR_TASKNOTFOUND", // 37
I still don't know what that means despite its appearance in fwerr.h.
The big picture is that my code opens a file called "data.csv" on onboard mmc. In response to a trigger, the next text line is sent to UART 1. The idea is to inject CSV lines instead of barcode strings, which come in UART 0. That file is currently just sequential numbers in ASCII:
00000001
00000002
00000003
00000004
00000005
I can send 1, 2, 3, then login to ftp and run ls, which triggers this code. Then I can continue, injecting 4, 5, ..., even though the code below uses ftell and fseek to read the file size. This code is called from FTPD_GetFileSize:
Code: Select all
if (NULL != DataCsvFile_p)
{
if (!strcmp(pFn, DataCsvFileName))
{
unsigned long pos0 = f_tell(DataCsvFile_p);
f_seek(DataCsvFile_p, 0, SEEK_END);
ret = f_tell(DataCsvFile_p);
f_seek(DataCsvFile_p, pos0, 0);
}
}
f_tell returns 37 in both places. It returns 37 if I send a few lines and try again. f_stat and f_findfirst also return 37 with junk in the structures.
The fact that correct text lines are coming out when I trigger tells me that I am opening the mmc and the file correctly.
Can anyone give me a hint or example of the proper use of seek/tell or stat in Netburner EFFS? I am using chip 54415 with Netburner IDE 2.8.2 on Win10.
Thanks,
Larry