Why I can't write data to SD card using MFS in different task?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why I can't write data to SD card using MFS in different task?

491 Views
botaoyang
Contributor II

I want to use MFS to write data to SD  card. now I have three task(main_task, init_task, temp_task), the main task is a auto_start task, the init task and temp task are created by the main task. the sd and mfs is inited in init_task, I can create and write data in main_task using mfs, but I can't do this in temp_task. Is there any method to make the mfs work in any task?

I am using MQX 4.1, and the board is my own demo board which is tested to be ok.

Labels (1)
0 Kudos
1 Reply

242 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Botao:

In your case, init_task and temp_task are not in the same context.  If you need several tasks to write  data to the same SD card, you need to pay attention to the  communication and  synchronization between tasks.

You can refer to the web_hvac example,

C:\Freescale\Freescale_MQX_4_2\demo\web_hvac\logging_task.c

In this example, several tasks need to write data to USB. There is a light weight semaphore and a message queue to achieve this.

Regards

Daniel

0 Kudos