_io_mfs_install fails with ffs_wl

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

_io_mfs_install fails with ffs_wl

570 Views
degry
Contributor I

I try to use K60F120M tower nand flash with ffs_wl and used the example in the MQX tree as a starting point. As far as I can see, the IO pins are set OK.

In the code below, which is part of the the shell ffs_open command, nandflash_handle gets a value but _io_mfs_install fails (internally, it hangs when it tries to install a lw_semaphore).

I use CW10.3 with MQX4.1.

Any idea why this happens and/or is there a check to see if the hardware access is OK (simple read/write from the nand...?)?

        /* Open nand flash wl in normal mode */

        nandflash_handle = fopen(FFS_DEVICE, NANDWL_OPEN_NORMAL);

        if ( nandflash_handle == NULL )

        {

            printf("Unable to open NAND Flash device.\n");

            printf("\nYou must run \"ffs_repair\" command\n");

            return 0;

        }

      

        /* Install MFS over nand_wl driver */

        error_code = _io_mfs_install(nandflash_handle, filesystem_name, (_file_size)0);

        if (error_code != MFS_NO_ERROR)

        {

            printf("Error initializing MFS: %s\n", MFS_Error_text((uint32_t)error_code));

            return 0; //_task_block();

        }

0 Kudos
Reply
2 Replies

419 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Patrik

I tried this demo on K60F120m without any issue.  I use Codewarrior 10.6 and MQX 4.1.1.

I suggest you use Codewarrior 10.6, because Freescale MQX RTOS was compiled and tested with Codewarror 10.6.

Please check the development tools requirements in the  release note for detail.

Regards

Daniel

0 Kudos
Reply

419 Views
degry
Contributor I

Hello,

I started all over with 10.6, MQX 4.1.1 and the example on twrK60f120. The example worked well.

Then I ported the mqx tree to my location and did some code modifications to make the example code fit in my application: it still worked, as long as you onlky have one SHELL task.

The problem starts when you have several other tasks with higher priority:

I need RTSC (network + ftp), my own COMM task, my own custom task and SHELL including SAI (for playing audio): SHELL has the lowest priority because it is blocking.

RTSC and COMM need high priority in order not to miss network traffic.

At startup, the ffs device itself is always installed correctly. But then, the file system must be activated and this hangs most of the time (the lw_semaphore thing).

At a certain point after testing many task startup scenarios, I could FTP files to the NAND flash and I could see the files when typing "dir" in the shell, but the application could not open these files. Also when FTP'ing bigger files to the NAND, things look very unstable.

Note that all works well with a SD card! The reason I need the FFS NAND flash system, is that I don't want the SDcard holder: the pcb needs to be coated (for humidity).

Conclusion: the ffs example becomes very unstable when other higher priority tasks are running

below: EXEC is starting the orther tasks. Sdcard is NOT started....

.

#define EXEC_TASK             1 //+8 = 10

#define IP_TASK                    2 //+8 = 11

#define COMM_TASK            3 //+8 = 12

#define SDCARD_TASK        4 //+8 = 13

#define INIT_TASK                 5 //+8 = 14

#define SHELL_TASK            6 //+8 = 15

const TASK_TEMPLATE_STRUCT MQX_template_list[] =

{

  //  Task Index,       Function,           Stack,                Priority (>=8),                          Name,           Attributes,           Param,  Time Slice

  { EXEC_TASK,          Exec_task,               2000,                 (8+EXEC_TASK),            "Exec",         0,       0,       0 },

  { IP_TASK,                 Ip_task,                    3000,                 (8+IP_TASK),                   "Ip",           0,                         0,       0 },

  { COMM_TASK,         Comm_task,            4000,                 (8+COMM_TASK),            "Comm",         0,                         0,       0 }, 

  { SDCARD_TASK,     Sdcard_task,          1500,                  (8+SDCARD_TASK),       "sdcard",  0,       0,       0 },

  { INIT_TASK,              Init_task,                 2000,                  (8+INIT_TASK),                "init",    0,                   0,       0 },

  { SHELL_TASK,         Shell_task,              4000,                  (8+SHELL_TASK),           "Shell",        MQX_AUTO_START_TASK,       0,       0 }, 

  { 0, 0, 0, 0, 0, 0 }

};

0 Kudos
Reply