2016-12-15 09:13 AM
Hello All,
I am working on STM32F407ZGT6 and HY27UF081G2A NAND Flash. You can find schematics and data sheets in the attached file. I am using CubeMX to generate codes on Keil U5. You can find initialization codes below.
/** Perform the NAND1 memory initialization sequence*/
hnand1.Instance = FSMC_NAND_DEVICE; /* hnand1.Init */ hnand1.Init.NandBank = FSMC_NAND_BANK2; hnand1.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_ENABLE; hnand1.Init.MemoryDataWidth = FSMC_NAND_PCC_MEM_BUS_WIDTH_8; hnand1.Init.EccComputation = FSMC_NAND_ECC_DISABLE; hnand1.Init.ECCPageSize = FSMC_NAND_ECC_PAGE_SIZE_512BYTE; hnand1.Init.TCLRSetupTime = 0x2; hnand1.Init.TARSetupTime = 0x2; /* hnand1.Info */ hnand1.Info.PageSize = 0x00000800; // 2048 Bytes/Page hnand1.Info.SpareAreaSize = 0x00000040; // 64 Bytes Spare hnand1.Info.BlockSize = 0x00000040; // 64 Pages/Block hnand1.Info.BlockNbr = 0x00000400; // 1024 Blocks hnand1.Info.ZoneSize = 0x00000400; // 1024 Blocks/Zone /* ComSpaceTiming */ ComSpaceTiming.SetupTime = 0x5; ComSpaceTiming.WaitSetupTime = 0x3; ComSpaceTiming.HoldSetupTime = 0x2; ComSpaceTiming.HiZSetupTime = 0x5; /* AttSpaceTiming */ AttSpaceTiming.SetupTime = 0x5; //0; AttSpaceTiming.WaitSetupTime = 0x3; //2; AttSpaceTiming.HoldSetupTime = 0x2; //1; AttSpaceTiming.HiZSetupTime = 0x5; //4;if (HAL_NAND_Init(&hnand1, &ComSpaceTiming, &AttSpaceTiming) != HAL_OK)
{ Error_Handler(); }When I try to readID (HAL_NAND_Read_ID) it looks like the CPU is stuck. It doesn't go further after the first line of the command sequence.
/* Send Read ID command sequence */
*(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_READID;(it looks like it is in an infinite loop here)
*(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00U;I would appreciate it if someone help me with the issue.
Regards.
Tugrul
2016-12-15 09:37 AM
hnand1.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_ENABLE;
to
hnand1.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_DISABLE;
solved the problem
2017-04-13 11:19 PM
Thank you very very much!! You have just save my week!!
2017-06-19 09:29 AM
Thank you!
I had the same Problem.
@ST: is there an option in CubeMX to configure the
Waitfeature ? If not, can you add it?
Thanks a lot!
2017-06-29 05:24 AM
Hello,
Your request raised internally to the appropriate team.
Regards
Imen
2017-10-30 03:03 PM
Hi Tugrul Matras,
I am new to ST and am using the same config to read the Nand flash. Did your profiled on how quickly you can read from the flash. I see that the reads using processor are extremely slow.
Thanks,
AQ
2018-01-30 12:13 AM
Hi
Matras.Tugrul
,Granados.Elkin
andTekampe.Jens
,Regarding
Matras.Tugrul
'spost, you can change the value ofhnand1.Init.Waitfeature in the pinout view/FSMC/Nand Flash1/ Ready or busy (I am working on the lastest CubeMX release 4.24) :
it will automatically generate the following code :
BR. Jeanne