Corrupt TXT File Troubleshooting

Hello everyone. After experimenting with my Arduino board I programmed an FPGA to write data to a SD card. When I write a text file to the card and then over write the txt file I am able to open the text file with no problems. When I format the card and write a new txt file to the card windows give me an error message saying the file is corrupt. In both cases the card is receving the same data from the host so I am at a bit of a loss as to why one works and one does not.

What is the best way to determine why windows thinks the file is corrupt? I have used win hex to look at the bytes on the card and the file that windows can open and the file that windows says is corrupt look the same to me.

Thanks

There is no easy way to know what Windows has found. I have programs that help find problems with file systems but these programs are tools, not somthing others could use.

Thanks for the response and that's too bad. I have seen that there are some utilities that can repair corrupted files. Do you have any recommendations for which ones work well?

Can't help with a repair program. I don't trust them.

What is the best way to determine why windows thinks the file is corrupt? I have used win hex to look at the bytes on the card and the file that windows can open and the file that windows says is corrupt look the same to me.

The best way is for you to show use (particularly fat16lib) the code that you are using to write the file on the SD card, so we can help you stop creating corrupt files.

Thanks for the offer, but as I said in the post I am programming an FPGA and my logic is instantiated using Verilog. I am not sure if posting Verilog code would be tolerated on this forum.

I am programming an FPGA and my logic is instantiated using Verilog. I am not sure if posting Verilog code would be tolerated on this forum.

Probably not. If you are not having an problem with Arduino or an Arduino library, why are you even here?

@Hooligan,

but there is a reason why you came to this forum. Can you explain why you asked it here iso some verilog forum?