cancel
Showing results for 
Search instead for 
Did you mean: 

I am having problems with QSPI interface here to talk to a 4Mbit NOR Flash (Flash MX25V4035F ). It looks like Initialization succeeds and chip erases. However, I get HAL error on sending any command such as Write Enable or Read ID.

PRama.3
Associate II

The Hardware Configuration is

/* Initialize QSPI Lines

  *

  * GPIO Pin Function

 * PE7  :  QSPI_BK2_IO3

 * PFE8  :  QSPI_BK2_IO2

 * PE9  :  QSPI_BK2_IO1

 *  PE10  :  QSPI_BK2_IO0

 *  PA7  :  QSPI_CLK

 * PC12  : QSPI_BK2_NCS

  * */

  GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10;

  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; // alternate function

  GPIO_InitStruct.Pull = GPIO_PULLUP;//GPIO_NOPULL; // Enable internal pull ups in device for IO lines

  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

  HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_12; // CS

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;//GPIO_MODE_OUTPUT_PP; //GPIO_MODE_AF_PP;// GPIO_MODE_OUTPUT_PP; // // alternate function disabled

   GPIO_InitStruct.Pull = GPIO_PULLUP;

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_7; // CLK

   GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; // alternate function

   GPIO_InitStruct.Pull = GPIO_NOPULL; // alternate function

   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

   HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

------------------------------------------------------------------------------------------------------------------

9 REPLIES 9
SBEN .2
Senior II

Hello @PRama.3​ ,

What microcontroller and what cube firmware version you're using?

Best regards,

@SBEN .2​ 

Missing a lot of salient detail.

W​hat STM32 part?

How is the AF setting for the pin configured?

Any relevant QSPI initialization or related code?

Assume few here are psychic, express detail.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PRama.3
Associate II

I am using STM32F469VGT6 (LQFP100 Part).

The intitialization of QSPI Lines in alternate mode GPIO:

/* Initialize QSPI Lines

*

* GPIO Pin Function

* PE7 : QSPI_BK2_IO3

* PFE8 : QSPI_BK2_IO2

* PE9 : QSPI_BK2_IO1

* PE10 : QSPI_BK2_IO0

* PA7 : QSPI_CLK

* PC12 : QSPI_BK2_NCS

* */

GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; // alternate function

GPIO_InitStruct.Pull = GPIO_PULLUP;//GPIO_NOPULL; // Enable internal pull ups in device for IO lines

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_12; // CS

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;//GPIO_MODE_OUTPUT_PP; //GPIO_MODE_AF_PP;// GPIO_MODE_OUTPUT_PP; // // alternate function disabled

GPIO_InitStruct.Pull = GPIO_PULLUP;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_7; // CLK

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; // alternate function

GPIO_InitStruct.Pull = GPIO_NOPULL; // alternate function

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

// Set QSPI NCS to inactive state- Pull High

// HAL_GPIO_WritePin(GPIOC, GPIO_PIN_12, GPIO_PIN_SET);

The QSPI init code is attached in the file

PRama.3
Associate II

Cube FW version is 6.2.0 and STMCube FW package for STM32F4 series is 1.26.1

You're not configuring the pins properly

NCS is not driven manually with QSPI, it needs to be under the control of the QSPI peripheral

The pins aren't associated with the QSPI peripheral via the AF mux selection

Review the AF pin tables in the Data Sheet for your part

PE10:AF10

PE9:AF10

PE8:AF10

PE7:AF10

PA7:AF10

PC12 NO needs to be PC11:AF9 for QUADSPI_BK2_NCS

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

https://www.st.com/resource/en/datasheet/stm32f469vg.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PRama.3
Associate II

OK . Thanks - Will look into this and report back.

Things apt to fail in the auto-polling loops, or where time-outs expire because the chip is not responding.

For erase make sure timeout covers expected time for completion and device to report as ready.

Write Enable waits for an acknowledgement / change in status, will fail if communication issue.

Read ID should be fairly instructive, pull whole data pages, didn't deep-dive this MX part, but usually there's more data and serialization info than just mfg/part info.

Check Read, Read Dual type commands first. Check if Quad needs enabling, check Read Quad

Check Erase

Check Write with simple patterns, similarly Write Dual, Write Quad, expectations in dummy clocks, page size, and write timing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PRama.3
Associate II

I tried with changed configuration

Write enable fails at this point

if (HAL_QSPI_AutoPolling(&hqspi, &sCommand, &sConfig,

HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {

return HAL_ERROR;

}