Skip to main content
Explorer
September 6, 2023
Question

While reading the NAND memory ID, first time itself getting the status as "READY"(without NAND).

  • September 6, 2023
  • 4 replies
  • 1897 views

Please give a reason on the following issue.

1. While reading the NAND memory ID, the status of the NAND memory is coming as READY. Even without NAND memory also the same is coming. What would be the reason?

2. "hnand-> state " how this state is fixing by the NAND memory controller.

Thanks in Advance

ABIN

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    September 6, 2023

    Hello @Abin,

    Could you please provide more details about NAND Flash being used? Product? General note, HAL driver is a set of generic APIs which handle standard NAND flash operations. If a NAND flash device contains different operations and/or implementations, it should be implemented separately.

     

    AbinAuthor
    Explorer
    September 13, 2023

    Hai @FBL 

    The memory which I am using is MT29F2G16ABAEAWP. It is 2 Giga Bit , 128X16 Memory.Total Number of Blocks are 2048 and it has Two planes.

    Here I have checked the Memory data sheet and verified that the commands which is being used in HAL library is correct.

    How to do the initial settings perfectly. No other resources are available

    Thanks in Advance

     

    Technical Moderator
    September 13, 2023

    Hello @Abin ,

    FMC NAND Flash memory controller has to be typically initialized to meet the characteristics of the memory in terms of features, timings, data width.

    MT29F2G16ABAEAWP Memory Data Width is 16 bit.

    Page size x16: 1056 words (1024 + 32 words)

     /* hNand Init */
     hNand->Init.NandBank = FMC_NAND_BANK3;
     hNand->Init.Waitfeature = FMC_NAND_WAIT_FEATURE_ENABLE;
     hNand->Init.MemoryDataWidth = FMC_NAND_MEM_BUS_WIDTH_16;
     hNand->Init.EccComputation = FMC_NAND_ECC_DISABLE;
     hNand->Init.ECCPageSize = FMC_NAND_ECC_PAGE_SIZE_2048BYTE;
     hNand->Init.TCLRSetupTime = 2;
     hNand->Init.TARSetupTime = 2;
    
     /* hNand Config */
     hNand->Config.PageSize = 1024; /*1024 words*/
     hNand->Config.SpareAreaSize = 32; /*32 words */
     hNand->Config.BlockSize = 64; /*64 pages*/
     hNand->Config.BlockNbr = 2048;
     hNand->Config.PlaneSize = 2048; /*NAND memory plane size measured in number of blocks */
     hNand->Config.PlaneNbr = 1;
     hNand->Config.ExtraCommandEnable = DISABLE;
    
     /* ComSpaceTiming */
     ComSpaceTiming.SetupTime = 1; /*according to AN4761 page 33*/
     ComSpaceTiming.WaitSetupTime = 7;
     ComSpaceTiming.HoldSetupTime = 2;
     ComSpaceTiming.HiZSetupTime = 8;
    
     /* AttSpaceTiming */
     AttSpaceTiming.SetupTime = 1; /*according to AN4761 page 33*/
     AttSpaceTiming.WaitSetupTime = 7;
     AttSpaceTiming.HoldSetupTime = 2;
     AttSpaceTiming.HiZSetupTime = 8;
    
     if (HAL_NAND_Init(hNand, &ComSpaceTiming, &AttSpaceTiming) != HAL_OK)
     {
     return HAL_ERROR;
     }
     if (HAL_NAND_Reset(hNand) != HAL_OK)
     {
     return HAL_ERROR;
     }

    You may need to check the HW connections as well. I suggest you taking a look to AN4761 https://www.st.com/resource/en/application_note/an4761-using-stm32l476486-fsmc-peripheral-to-drive-external-memories--stmicroelectronics.pdf 

    Enjoy!

    Graduate II
    September 13, 2023

    It could be that reading an empty bus returns values (high or low) that look to indicate something is "READY", but that really doesn't positively determine device presence. You might have to do more, like read a JEDEC ID and compare that against expected or usable devices.

    If the F(S)MC isn't initialized for the memory range you can expect a Hard Fault.