cancel
Showing results for 
Search instead for 
Did you mean: 

sd fatfs can only change letters

EPora.1
Associate II

Hello,

I'm using fatfs by chan with this SD driver http://stm32f4-discovery.net/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/ and with my own SPI driver. I have successfully mounted and opened a file but when I try to write using f_puts, it returns a valid number but nothing is written to the file. If I open the file, then in my PC add text and then try to write stuff to the file, it can write only bytes that were pre written.

Thanks!

Eyal

Edit:

I've also noticed that if I try to write to a file after I create it the f_puts returns -1 and then if I run the code again it returns a valid number but still doesn't write anything

another edit:

In an HEX editor I can see that the bytes have been written but the file probably doesn't know its size?0693W00000FBAaLQAX.jpg

2 REPLIES 2
PMath.4
Senior III

Are you closing the file? File I/O is buffered so you need to f_sync or f_close

Yes, I've also added f_sync and it still doesn't write anything