2024-04-25 12:52 PM
Hi, we see STM32H7 has Qspi errata as below:
But we are not sure where to apply the patch exactly. It says "upon reset and upon switching from memory-mapped", mean in reset function, right after or before "HAL_QSPI_Init"?
Solved! Go to Solution.
2024-04-25 01:28 PM
Good Question.
I'd think prior to HAL_QSPI_Init(), but after the APB ENA / RST for the peripheral/clocks. And apparently after a bus abort.
Reading between the lines here, and looking at the prescaler changes, I would suppose there's some synchronous circuitry in there that doesn't take an async reset, or short clock count synchronous reset. ie in a slower domain, engaged inopportunely
Say you're running the QSPI device at 25 MHz, via the prescaler, but hold the reset for a couple of 200 or 400 MHz cycles.
2024-04-25 01:28 PM
Good Question.
I'd think prior to HAL_QSPI_Init(), but after the APB ENA / RST for the peripheral/clocks. And apparently after a bus abort.
Reading between the lines here, and looking at the prescaler changes, I would suppose there's some synchronous circuitry in there that doesn't take an async reset, or short clock count synchronous reset. ie in a slower domain, engaged inopportunely
Say you're running the QSPI device at 25 MHz, via the prescaler, but hold the reset for a couple of 200 or 400 MHz cycles.
2024-04-25 09:28 PM
I think, I have seen that STM provides in HAL drivers code to do an "estimation" of the correct timing. I think to remember there is some code which figures out what the external timing is and how to configure QSPI.
If so, you would run this code after QSPI is configured and enabled, but before you change into Memory Mapped mode (which needs the "correct" timing).
I think, it is this code (which "calibrates" the DLYB delays) - I found it in one of my project now:
HAL_OSPI_DLYB_Cfg_Struct.Units = 0;
HAL_OSPI_DLYB_Cfg_Struct.PhaseSel = 0;
if (HAL_OSPI_DLYB_SetConfig(&hospi1, &HAL_OSPI_DLYB_Cfg_Struct) != HAL_OK)
{
Error_Handler();
}
This I do right after the:
if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
2024-04-26 02:32 AM - edited 2024-04-26 06:13 AM
Hello @Dat Tran ,
Edit:
As mentioned by @Tesla DeLorean the workaround is used after enabling peripherals/clocks and before HAL_QSPI_Init().
Also this workaround is applied when switching from memory mapped to any other modes.
Thank 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.
2024-04-26 06:05 AM - edited 2024-04-26 06:06 AM
Following @KDJEM.1 : "before enabling peripheral clock and after HAL_QSPI_Init()."
Following @Tesla DeLorean : "prior to HAL_QSPI_Init(), but after the APB ENA / RST for the peripheral/clocks"
Following the ST HAL Driver: enabling peripheral clock is inside HAL_QSPI_Init()
```
HAL_StatusTypeDef HAL_QSPI_Init(QSPI_HandleTypeDef *hqspi)
{
//.... ST code
......
Question: Apply workaround here????
/* Enable the QSPI peripheral */
__HAL_QSPI_ENABLE(hqspi);
or Apply workaround here????
........
// ... ST Code
return status;
}
```
so I am still confused, could you please point out a bit more clear?
2024-04-26 06:12 AM - edited 2024-04-26 06:20 AM
Hello @Dat Tran ,
I apologize for this typo and this confusion "The workaround is used before HAL_QSPI_Init(). " as explain by @Tesla DeLorean
Thank 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.