Skip to main content
DWill.4
Associate II
June 1, 2021
Solved

BSP QSPI vs CubeMx Initialization Difference

  • June 1, 2021
  • 1 reply
  • 1846 views

l have initialized the Micron MT25TL01G QSPI chip with the BSP_QSPI_Init() function. I am able to read, write, and erase data to the QSPI using the underlying MT25TL01G functions beneath the BSP. Whenever l remove the BSP initialization l don't receive an output from MT25TL01G_ReadDTR().

This may sound silly, but doesn't CubeMx initialize the QSPI Chip with HAL_QSPI_Init?

Could this be an QSPI_MspInit() vs HAL_QSPI_MspInit() configuration issue?

Parameters:

 /* 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 */

 BSP_QSPI_Init_t init;

 init.InterfaceMode = MT25TL01G_QPI_MODE;

 init.TransferRate = MT25TL01G_DTR_TRANSFER;

 init.DualFlashMode = MT25TL01G_DUALFLASH_DISABLE;

 if (BSP_QSPI_Init(0, &init) != BSP_ERROR_NONE)

 {

    Error_Handler();

 }

 /* USER CODE END QUADSPI_Init 2 */

This topic has been closed for replies.
Best answer by Andreas Bolsch

By inspecting the source code of HAL_QSPI_Init you will see that this function initializes only the QSPI interface (within the STM32), not the flash chip. Most SPI flash chips power up in SPI mode (single line), 3-byte address, STR. As you apparently intend to use QPI, 4-address, DTR, the flash chip must be configured accordingly. Number of dummy cycles is another point. How this is done depends heavily on the flash model, so ...

Some flash devices allow non-volatile configuration, but this must be done once, too. Hence no way to omit the configuration step.

1 reply

Andreas Bolsch
Andreas BolschBest answer
Lead III
June 1, 2021

By inspecting the source code of HAL_QSPI_Init you will see that this function initializes only the QSPI interface (within the STM32), not the flash chip. Most SPI flash chips power up in SPI mode (single line), 3-byte address, STR. As you apparently intend to use QPI, 4-address, DTR, the flash chip must be configured accordingly. Number of dummy cycles is another point. How this is done depends heavily on the flash model, so ...

Some flash devices allow non-volatile configuration, but this must be done once, too. Hence no way to omit the configuration step.