This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flash-FS on SPI NAND

Hi All,

I have read the documentation and scoured the forum but (!) I am still unsure whether Keil provides a solution for FAT filesystem + SPI NAND.

FAT FS + NAND, yes I see that and FAT FS + SPI SD Card, yes I see that also, but not FAT FS + SPI NAND.

Can anyone quickly and easily clarify this one for me?

Regards

Andy

Parents
  • It is just as "simple" as you said :)

    Page Read/Write and Erase Block functions need to be implemented and in addition, if internal ECC in MT29F4G01 will be used, NAND page layout must be adjusted. According to datasheet, it must be done like this:

    static void SetupPageLay (NAND_DRV_CFG *cfg) {
      NAND_PG_LAY *pgLay = cfg->PgLay;
    
      /* According to MT29F4G01 datasheet, page 36 */
      if (cfg->PageSize == 2112) {
        /* Setup page layout */
        pgLay->Pos_BBM  = 0;      /* Bad block data        */
        pgLay->Pos_LSN  = 2;      /* Logical sector number */
        pgLay->Pos_COR  = 6;      /* Data corrupted marker */
        pgLay->Pos_ECC  = 8;      /* ECC data              */
    
        pgLay->SectInc  = 512;    /* Byte address increment till next sector */
        pgLay->SpareOfs = 2048;   /* Byte address of the first spare         */
        pgLay->SpareInc = 16;     /* Byte address increment till next spare  */
      }
    }
    

    If internal ECC logic won't be used, you must enable ECC in software through the File_Config.c and then there is no need to adjust page layout - flash translation layer will take the default settings.

Reply
  • It is just as "simple" as you said :)

    Page Read/Write and Erase Block functions need to be implemented and in addition, if internal ECC in MT29F4G01 will be used, NAND page layout must be adjusted. According to datasheet, it must be done like this:

    static void SetupPageLay (NAND_DRV_CFG *cfg) {
      NAND_PG_LAY *pgLay = cfg->PgLay;
    
      /* According to MT29F4G01 datasheet, page 36 */
      if (cfg->PageSize == 2112) {
        /* Setup page layout */
        pgLay->Pos_BBM  = 0;      /* Bad block data        */
        pgLay->Pos_LSN  = 2;      /* Logical sector number */
        pgLay->Pos_COR  = 6;      /* Data corrupted marker */
        pgLay->Pos_ECC  = 8;      /* ECC data              */
    
        pgLay->SectInc  = 512;    /* Byte address increment till next sector */
        pgLay->SpareOfs = 2048;   /* Byte address of the first spare         */
        pgLay->SpareInc = 16;     /* Byte address increment till next spare  */
      }
    }
    

    If internal ECC logic won't be used, you must enable ECC in software through the File_Config.c and then there is no need to adjust page layout - flash translation layer will take the default settings.

Children
No data