cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read NAND flash ID

ashutoshtekriwal
Associate III

Hello,

We have been using NAND Flash (MT29F8G08ADAFAH4-AAT) interfaced with STM32L562 microcontroller using FMC interface. We are first trying to read the ID of the Flash using the below HAL API.

 

if(HAL_NAND_Read_ID(&hnand1, &NAND_ID) != HAL_OK)

{

return NAND_STATUS_READ_ID_ERROR;

}

 

But it is returning a read ID error. The section for the NAND initialization using FMC interfcace is provided below:

Please provide us some help.

 

 

/* FMC initialization function */

static void MX_FMC_Init(void)

{

 

/* USER CODE BEGIN FMC_Init 0 */

 

/* USER CODE END FMC_Init 0 */

 

FMC_NAND_PCC_TimingTypeDef ComSpaceTiming = {0};

FMC_NAND_PCC_TimingTypeDef AttSpaceTiming = {0};

 

/* USER CODE BEGIN FMC_Init 1 */

 

/* USER CODE END FMC_Init 1 */

 

/** Perform the NAND1 memory initialization sequence

*/

hnand1.Instance = FMC_NAND_DEVICE;

/* hnand1.Init */

hnand1.Init.NandBank = FMC_NAND_BANK3;

hnand1.Init.Waitfeature = FMC_NAND_WAIT_FEATURE_DISABLE;

hnand1.Init.MemoryDataWidth = FMC_NAND_MEM_BUS_WIDTH_8;

hnand1.Init.EccComputation = FMC_NAND_ECC_DISABLE;

hnand1.Init.ECCPageSize = FMC_NAND_ECC_PAGE_SIZE_256BYTE;

hnand1.Init.TCLRSetupTime = 0;

hnand1.Init.TARSetupTime = 0;

/* hnand1.Config */

hnand1.Config.PageSize = 4096;

hnand1.Config.SpareAreaSize = 256;

hnand1.Config.BlockSize = 64;

hnand1.Config.BlockNbr = 2048;

hnand1.Config.PlaneNbr = 2;

hnand1.Config.PlaneSize = 2048;

hnand1.Config.ExtraCommandEnable = DISABLE;

/* ComSpaceTiming */

ComSpaceTiming.SetupTime = 223;

ComSpaceTiming.WaitSetupTime = 223;

ComSpaceTiming.HoldSetupTime = 224;

ComSpaceTiming.HiZSetupTime = 223;

/* AttSpaceTiming */

AttSpaceTiming.SetupTime = 223;

AttSpaceTiming.WaitSetupTime = 223;

AttSpaceTiming.HoldSetupTime = 224;

AttSpaceTiming.HiZSetupTime = 223;

 

if (HAL_NAND_Init(&hnand1, &ComSpaceTiming, &AttSpaceTiming) != HAL_OK)

{

Error_Handler( );

}

 

/* USER CODE BEGIN FMC_Init 2 */

 

/* USER CODE END FMC_Init 2 */

}

 

1 ACCEPTED SOLUTION

Accepted Solutions

 

Thank you for the reply. We were able to make NAND flash work by change in timing numbers and clock frequency(30Mhz maximum) for AHB bus. Thank You for your support

View solution in original post

2 REPLIES 2
KDJEM.1
ST Employee

Hello @ashutoshtekriwal ,

 

 Could you please make sure that the FMC is correctly configured for the NAND "MT29F8G08ADAFAH4-AAT"  Flash. 

May this application note can help you to check memory protection unit (MPU).

Also may you facing a hardware issue, for that please verify that all the necessary pins for the NAND interface are correctly configured and connected.

 

I hope this help you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

 

Thank you for the reply. We were able to make NAND flash work by change in timing numbers and clock frequency(30Mhz maximum) for AHB bus. Thank You for your support