cancel
Showing results for 
Search instead for 
Did you mean: 

FatFs for reading text file or binary file

MKS
Associate II

Hi,

I have stm32f103rb nucleo board

i want to read/write a text file from flash space of the board.

Is there any example for implementing this c ode.

i am using stm32cube ide.

Regards,

Manjunath K S

4 REPLIES 4

There should be examples for fatfs and internal flash erase/write.

Is there working code you can directly copy, probably not so much.

Going to be relatively small and slow. Pick the block/sector size to match those of the F1 part.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MKS
Associate II

Hi @Community member​ 

i got exampoles for reading from sd card, i just want to read a text file for my application.

Regards,

manjunath

It is all just a collection of bytes at the end of the day. FatFs works very much like standard C file IO functions. Read a block or buffer full of data, and parse the ASCII data, break it into strings or whatever.

If you just need to output the content of a file and output to a UART, you could open, get length information, and then read a buffer full at a time, sending to the serial device until all the content is consumed and then closed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MKS
Associate II

Hi,

I am just new to this , as in c cant we use FILE pointer for reading the file, if so what will be location of the file in flash.

i am not able to find any sample code or so to figure out the exact steps.

Regards,

manjunath