I have a 200Kbyte file on sd card. I use the following code on MQX 3.8 to read the file read (log_fp, data,3); using this code I can only read the first 900 bytes of the file. I have problem to read the rest of the file correctly! I tried fread() and fgetc() I got the same issue. Any suggestion for me?
Thnaks
How to check whether there is a sector problem or file system problem??
At first, please make sure that the issue is not caused by a damaged SD card or corrupted filesystem on it.
Try to read the file on PC and also try a different newly formatted SD card with a file of the desired size.
If the problem persists, please provide us with more details. Such erratic behaviour of MFS read function was not observed so far, so the actual reason cannot be identified with the brief description provided.
I understand amleng is asking for help for a specific problem, but I would like tools, and or APIs to verify a disk functionally so that logic can be built to heal issues that might occur in the field.
That's true. It was sd card problem. Sounds a few bad sectors issue! Thanks