Why does HAL_QSPI_AutoPolling keep polling whereas the timeout has been reached and returning an error flag ?
Hello everyone,
I'm today encountering a new issue where your help will be more than welcome.
I'm communicating with an external Flash Memory using the QSPI of the STM32H7 than I own and everything is working as expected at the first run. I can write and read status without any problem.
However when I wanted to have some code more reliable by adding some check status, using the HAL_QSPI_AutoPolling, of my Flash Memory I run into some issue.
Here is the configuration I'm running to have this issue:
QSPI_CommandTypeDef sCommand;
QSPI_AutoPollingTypeDef sConfig;
HAL_StatusTypeDef err = HAL_ERROR;
//! # Configure automatic polling mode to wait for memory ready (WIP bit)
sCommand.InstructionMode = QSPI_INSTRUCTION_1_LINE;
sCommand.Instruction = S25F064L_CMD_RDSR1;
sCommand.AddressMode = QSPI_ADDRESS_NONE;
sCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
sCommand.DataMode = QSPI_DATA_1_LINE;
sCommand.DummyCycles = 0;
sCommand.DdrMode = QSPI_DDR_MODE_DISABLE;
sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
sCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
//! ## WIP bit should not be set
sConfig.Match = 0x02;
sConfig.Mask = S25F064L_SR1V_WIP;
sConfig.MatchMode = QSPI_MATCH_MODE_AND;
sConfig.StatusBytesSize = 1;
sConfig.Interval = 0x10;
sConfig.AutomaticStop = QSPI_AUTOMATIC_STOP_ENABLE;
//! ## Start polling
HAL_GPIO_WritePin(DBG_PIN_1_GPIO_Port, DBG_PIN_1_Pin, GPIO_PIN_SET);
err = HAL_QSPI_AutoPolling(&hqspi, &sCommand, &sConfig, S25F064L_TIMEOUT);
HAL_GPIO_WritePin(DBG_PIN_1_GPIO_Port, DBG_PIN_1_Pin, GPIO_PIN_RESET);
if (err != HAL_OK)
{
HAL_QSPI_Abort(&hqspi);
}Setting the Mask Match to 0x02 is making me having this issue, since the value returning and expected by my product is 0x00. It was at first a mistakes of mine, but I then realized that this behavior is not what I was expected and can't get it work properly with the wrong value.
I am sure than the timeout is working properly since my external pin is toggling as expected (after 100ms) as you can see in the screenshot of my logic analyser.
But you can also see than the communication is not stopping even with the presence of the HAL_QSPI_Abort command.
