Skip to main content
AMerc.4
Senior
June 3, 2020
Question

NOR Flash memory Quad SPI initialization

  • June 3, 2020
  • 2 replies
  • 1748 views

Hello,

i need to use this flash memory with Quad SPI. I read the STM32 user manual and some examples of random evaluation boards.

I think that this first step initialization should be ok

static void MX_QUADSPI_Init(void)
{
 
 /* USER CODE BEGIN QUADSPI_Init 0 */
 
 /* USER CODE END QUADSPI_Init 0 */
 
 /* USER CODE BEGIN QUADSPI_Init 1 */
 
 /* USER CODE END QUADSPI_Init 1 */
 /* QUADSPI parameter configuration*/
 hqspi.Instance = QUADSPI;
 hqspi.Init.ClockPrescaler = 2;
 hqspi.Init.FifoThreshold = 4;
 hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
 hqspi.Init.FlashSize = 25;
 hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_2_CYCLE;
 hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
 hqspi.Init.FlashID = QSPI_FLASH_ID_1;
 hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
 if (HAL_QSPI_Init(&hqspi) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN QUADSPI_Init 2 */
 
 /* USER CODE END QUADSPI_Init 2 */
 
}

Knowing that i'm using 200MHz with internal oscillator.

But i don't know the other initialization parameters to put. Can you help me?

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
June 3, 2020

Tip of the iceburg there.

Most of the ICs will go 50 MHz

Real complexity is at the command level for the specific chips (Winbond W25Q256) for read, write, erase, etc.

Review the code for the Micron parts used in the F7/H7 DISCO/EVAL boards, see BSP code in the drivers directories of CubeF7/H7 archives.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AMerc.4
AMerc.4Author
Senior
June 3, 2020

Ok, just to be sure. Suppose i have the N25Q512A chip. I have stm32f769i_eval_qspi.h, stm32f769i_eval_qspi.c and n25q512a.h files taken from official BSP repository.

What should i do now?

Should i include stm32f769i_eval_qspi.h inside my main.c and, after calling MX_QUADSPI_Init();, should i call BSP_QSPI_Init();?

AMerc.4
AMerc.4Author
Senior
June 9, 2020

I did it by writing the driver from scratch.