Skip to main content
Visitor II
October 1, 2021
Question

sd fatfs can only change letters

  • October 1, 2021
  • 1 reply
  • 780 views

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

    This topic has been closed for replies.

    1 reply

    Visitor II
    October 1, 2021

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

    EPora.1Author
    Visitor II
    October 1, 2021

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