Question
problem using STM32F407 FSMC with NOR flash
Posted on January 28, 2016 at 09:53
Hi all,
I am trying to interface with JR28F064M29EW NOR flash () using the STM32F407 MCU. However, I couldn't read the correct device ID from the NOR IC. So I want to ask whether there is anything wrong with my initialization code?Here is the initialization code: GPIO_InitTypeDef GPIO_Init_Structure; /* Enable FSMC clock */ __HAL_RCC_FSMC_CLK_ENABLE(); __HAL_RCC_FSMC_FORCE_RESET(); __HAL_RCC_FSMC_RELEASE_RESET(); /* Enable GPIOs clock */ __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); __HAL_RCC_GPIOG_CLK_ENABLE(); /* Common GPIO configuration */ GPIO_Init_Structure.Mode = GPIO_MODE_AF_PP; GPIO_Init_Structure.Pull = GPIO_PULLUP; GPIO_Init_Structure.Alternate = GPIO_AF12_FSMC; GPIO_Init_Structure.Speed = GPIO_SPEED_HIGH; /* GPIOD configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOD, &GPIO_Init_Structure); /* GPIOE configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOE, &GPIO_Init_Structure); /* GPIOF configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOF, &GPIO_Init_Structure); /* GPIOG configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_12; HAL_GPIO_Init(GPIOG, &GPIO_Init_Structure); hNor.Instance = FSMC_NORSRAM_DEVICE; hNor.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; /* NOR device configuration */ NOR_Timing.AddressSetupTime = 6; NOR_Timing.AddressHoldTime = 2; NOR_Timing.DataSetupTime = 8; NOR_Timing.BusTurnAroundDuration = 0; NOR_Timing.CLKDivision = 2; NOR_Timing.DataLatency = 2; NOR_Timing.AccessMode = FSMC_ACCESS_MODE_B; hNor.Init.NSBank = FSMC_NORSRAM_BANK3; hNor.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; hNor.Init.MemoryType = FSMC_MEMORY_TYPE_NOR; hNor.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; hNor.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; hNor.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; hNor.Init.WrapMode = FSMC_WRAP_MODE_DISABLE; hNor.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; hNor.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; hNor.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; hNor.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; hNor.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; hNor.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE; /* Initialize the NOR controller */ if(HAL_NOR_Init(&hNor, &NOR_Timing, &NOR_Timing) != HAL_OK) { /* Initialization Error */ Error_Handler(); } #nor #fsmc #stm32f407