Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎03-08-2018

xilffs write multiple time to SD card



I am currently using a Microzed with a Zynq 7010 and SDK 2015.4 (included with Vivado) and xilffs is version 3.1 .


As I am trying to interact with a Micro SD Card for later use in my project, I played with the "xilffs_polled_example.c" to understand how to use the functions.


Now I create my project in order to make function to load and write in a file with only the name of the file, the length of data and a data buffer in arguments. You can find those two function in SD_interface.c with "SD_Interface_chargerFichier" for the load part and "SD_Interface_ecrireFichier" for the write part.


Each function work as independent, however if I run them after the write one f_open return FR_INT_ERR.


I tried a solution of usleep(200) but can't find it any more (it explained that the old xilffs would not liberate the SD card just at the end of f_write). But it didn't work.


The current solution I have is to unmount the SDcard after my first write function and then remount it, after that I can do as many write or read operation I want.


If you want to try the problem, I put a define at the start of helloworld.c where "MODE_NORMAL" would run into the problem (it does the mount only on the start of the program) and "MODE_ANORMAL" would pass with the unmount/remount after the first write operation.

The helloworld.c is made with the idea of a "setting.txt" file already present on the SDcard (else it will fail).


Does someone as a workaround for this unmount/remount problem?


Also I have the same linker problem as this post :




Nicolas Merieux

0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
Registered: ‎02-01-2008

That error is documented here:


Is it possible that you are writing and reading to/frm the same file at the same time?


I see that your second SD_interface..... is opening a file as read/write

0 Kudos
Registered: ‎03-08-2018

@johnmcdThanks for your quick reply.

The read/write in the second interface is an omission from my part (should have been write only).


The documentation didn't give a great help, but it is still good to have (I'll try formatting the SD card with 0 in the event it is a FAT structure error).


The program should not be reading and writing to the same file at the same time since I do not program the second ARM core and run in a single thread (as far as I'm aware of).

The big project where the SD_interface will be used, use the SD card in the following manner :

1. At initialisation load a reference signal from a ref file and save it in a dedicated memory space.

2. After an acquisition, save the acquired signal as a binary file in the SD card.

3. Load and transform the binary file in a dedicated memory space.

4. After treatment save the transformed data from acquisition and results in a CSV file on the SD.

All of those actions should be done from the same core and same thread in the big project.


Current solution I employ is to mount the SD card at the start and unmount it at the end of each SD_interface. However this solution is "a bit" slow.


I joined the modified "xilffs_polled_example.c" that I used (named helloworld.c), in another project in SDK, to learn how to use the xillffs library.

0 Kudos