File System - adl_fsOpen issues with append mode
Background
This is my first time using Sierra Wireless.
I am creating a data logger that receives data at rates up to ~1KB / second.
- Received via UART serial
- Saved to the file system
- Transmitted - GSM, periodically when file system nearly full
- Using the Open AT projects “uart_access” and “file_system” as a basis
Issue Details
The append mode described by “adl_fsOpen” appears to be having issues. The file system is recording a multiple of 4KB without problems and then dumping a multiple of 4KB worth of 0xFF values into the file before continuing recording correctly.
Importantly, when running the program a second time you would expect it to simply pick up from where it left off. It does this but also it also writes more 0xFF values to previously recorded data which I don’t understand.
Example Code - Abridged
WRITE(buff, size){
...
filehandle=adl_fsOpen(file_name,"a");
adl_fsWrite(buff,1,size,filehandle);
adl_fsClose(filehandle);
...
}
main(){
adl_eventWait(...);
adl_eventClear(...);
wm_memset( buff, 0, 512 );
for (...){read data & set pointers}
WRITE(buff, size);
size=0;
}
Prototype
/**
@brief open a file for reading/writing/appending
@param[in] filename - which file need to be opened
@param[in] mode - string how to open ("r"-read, "w"-write, "w+"-overwrite, "a"-append
@retval ADL_FS_FILE pointer if successfully if successful
@retval NULL otherwise
*/
ADL_FS_FILE *adl_fsOpen(const char *filename,const char *mode);
Other issues, may or may not be related
- Occasional jumps in the data recorded / missed out
- Garbage data is appended to every line before carriage return, but it is the same garbage data repeated every line
Regards,
D Cross - Software Engineer