cancel
Showing results for 
Search instead for 
Did you mean: 

QSPI Initialization AutoPolling timeout without BSP

Richard Lowe
Senior III

Working with the STM32H747i-Eval board with a touchGFX application. Need the QSPI for assets and not wanting to use the BSP due to wanting to have more control over clock speeds and pinout configuration.

I'm in need of some more experienced advice when it comes to QSPI Flash. Clock to the QSPI peripheral is at the default of 200MHz. QSPI Flash onboard is limited to 90MHz. Clock prescaler is set to 3 (3 + 1 = 4 -> 200MHz / 4 = 50MHz). Which should be fine and is what is used in the BSP.

 

/* QUADSPI init function */
void MX_QUADSPI_Init(void)
{

  /* USER CODE BEGIN QUADSPI_Init 0 */
  MT25TL01G_Info_t pInfo;
  /* USER CODE END QUADSPI_Init 0 */

  /* USER CODE BEGIN QUADSPI_Init 1 */

  /* USER CODE END QUADSPI_Init 1 */
  hqspi.Instance = QUADSPI;
  hqspi.Init.ClockPrescaler = 3;
  hqspi.Init.FifoThreshold = 1;
  hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
  hqspi.Init.FlashSize = 26;
  hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_4_CYCLE;
  hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
  hqspi.Init.DualFlash = QSPI_DUALFLASH_ENABLE;
  if (HAL_QSPI_Init(&hqspi) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN QUADSPI_Init 2 */

 

This code matches the BSP. What is annoying about the BSP is that it DeInit(s) the peripheral and re-initializes it several times. No matter.... when it gets to AutoPolling to see if the memory is ready, I get a timeout. BUT, if I set the prescaler to 4 (200 / 5 = 40MHz) everything works fine. I'm fine with leaving it at 40MHz, but a couple things make me nervous.

Datasheet says to set the prescaler to an even number when used with Memory Mapped Mode. 
Would dummy cycles be the same with 40MHz as it is with 50MHz?

What are the parameters to change that would allow me to run the QSPI at 50MHz or higher?




1 ACCEPTED SOLUTION

Accepted Solutions
Richard Lowe
Senior III

I believe I have figured it out:

CubeMX generates the pin speed for QSPI to low. That doesn't seem to work well on the data lines.

Setting the pins to "Very High" seems to allow for higher QSPI speeds.

Screenshot from 2023-08-23 19-41-54.png

View solution in original post

2 REPLIES 2
Richard Lowe
Senior III

I believe I have figured it out:

CubeMX generates the pin speed for QSPI to low. That doesn't seem to work well on the data lines.

Setting the pins to "Very High" seems to allow for higher QSPI speeds.

Screenshot from 2023-08-23 19-41-54.png

KDJEM.1
ST Employee

Hello @Richard Lowe ,

For the QUADSPI configuration, all GPIO have to be configured in high-speed mode.

I think that the Quad-SPI interface on STM32 microcontrollers and microprocessors application note can help you to check QUADSPI configuration.
This application note describes all QUADSPI configuration steps required to perform either read, write or erase operations such as GPIOs configuration, QUADSPI peripheral configuration and clock.

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.