AnsweredAssumed Answered

STM32 FSCM can't read Id of Nand

Question asked by mordasov.ilya on Dec 15, 2015
Latest reply on Dec 16, 2015 by mordasov.ilya
Hi everybody, I'm trying to read/write data on and flash

So, I init gpio and handler, I use 8 bit bus

void initGPIO(void)
{
    GPIO_InitTypeDef GPIO_InitStruct;
 
    __GPIOE_CLK_ENABLE();
    __GPIOD_CLK_ENABLE();
 
    GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
 
    GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_7;
 
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
 
    HAL_NVIC_SetPriority(FSMC_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(FSMC_IRQn);
}
 
void initHandler(void)
{
    FSMC_NAND_PCC_TimingTypeDef ComSpaceTiming;
    FSMC_NAND_PCC_TimingTypeDef AttSpaceTiming;
 
    /** Perform the NAND1 memory initialization sequence
     */
    hnand.Instance = FSMC_NAND_DEVICE;
    /* hnand.Init */
    hnand.Init.NandBank = FSMC_NAND_BANK2;
    hnand.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_DISABLE;
    hnand.Init.MemoryDataWidth = FSMC_NAND_PCC_MEM_BUS_WIDTH_8;
    hnand.Init.EccComputation = FSMC_NAND_ECC_DISABLE;
    hnand.Init.ECCPageSize = FSMC_NAND_ECC_PAGE_SIZE_256BYTE;
    hnand.Init.TCLRSetupTime = 0;
    hnand.Init.TARSetupTime = 0;
    /* hnand.Info */
    /* ComSpaceTiming */
    ComSpaceTiming.SetupTime = 252;
    ComSpaceTiming.WaitSetupTime = 252;
    ComSpaceTiming.HoldSetupTime = 252;
    ComSpaceTiming.HiZSetupTime = 252;
    /* AttSpaceTiming */
    AttSpaceTiming.SetupTime = 252;
    AttSpaceTiming.WaitSetupTime = 252;
    AttSpaceTiming.HoldSetupTime = 252;
    AttSpaceTiming.HiZSetupTime = 252;
 
    HAL_NAND_Init(&hnand, &ComSpaceTiming, &AttSpaceTiming);
}
 
void readId(void)
{
    NAND_IDTypeDef NAND_ID;
    char buf[100];
 
    if (HAL_NAND_Read_ID(&hnand, &NAND_ID) == HAL_OK)
    {
        sprintf(buf, "Nand Flash ID = %02X,%02X,%02X,%02X\n",NAND_ID.Maker_Id, NAND_ID.Device_Id, NAND_ID.Third_Id, NAND_ID.Fourth_Id);
        print(but);
        }
}

When I call readId method I can see, that all NAND_ID's values equal 0

Documentation pointed that Marker_Id has to be 0xEC and Device_Id has to be 0xF1

It means that Marker_Id and other = 0

I use Samsung K9G1G08U0D 

Outcomes