Skip to content

Commit 9856e86

Browse files
committed
TARGET_STM32F7: Reset QSPI in default mode on abort for all versions.
This patch is missing in F7 HAL. Fix #10049 Signed-off-by: Vincent Veron <[email protected]>
1 parent 801e555 commit 9856e86

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/stm32f746xx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9668,8 +9668,6 @@ typedef struct
96689668
/* QUADSPI */
96699669
/* */
96709670
/******************************************************************************/
9671-
/* QUADSPI IP version */
9672-
#define QSPI1_V1_0
96739671
/***************** Bit definition for QUADSPI_CR register *******************/
96749672
#define QUADSPI_CR_EN_Pos (0U)
96759673
#define QUADSPI_CR_EN_Msk (0x1U << QUADSPI_CR_EN_Pos) /*!< 0x00000001 */

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/stm32f756xx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9937,8 +9937,6 @@ typedef struct
99379937
/* QUADSPI */
99389938
/* */
99399939
/******************************************************************************/
9940-
/* QUADSPI IP version */
9941-
#define QSPI1_V1_0
99429940
/***************** Bit definition for QUADSPI_CR register *******************/
99439941
#define QUADSPI_CR_EN_Pos (0U)
99449942
#define QUADSPI_CR_EN_Msk (0x1U << QUADSPI_CR_EN_Pos) /*!< 0x00000001 */

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_qspi.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,9 @@ void HAL_QSPI_IRQHandler(QSPI_HandleTypeDef *hqspi)
490490
__HAL_DMA_DISABLE(hqspi->hdma);
491491
}
492492

493-
#if defined(QSPI1_V1_0)
494-
/* Clear Busy bit */
493+
/* MBED, see #10049 */
494+
/* Clear Busy bit */
495495
HAL_QSPI_Abort_IT(hqspi);
496-
#endif
497496

498497
/* Change state of QSPI */
499498
hqspi->State = HAL_QSPI_STATE_READY;
@@ -529,10 +528,10 @@ void HAL_QSPI_IRQHandler(QSPI_HandleTypeDef *hqspi)
529528
}
530529
}
531530
}
532-
#if defined(QSPI1_V1_0)
531+
532+
/* MBED, see #10049 */
533533
/* Workaround - Extra data written in the FIFO at the end of a read transfer */
534534
HAL_QSPI_Abort_IT(hqspi);
535-
#endif /* QSPI_V1_0*/
536535

537536
/* Change state of QSPI */
538537
hqspi->State = HAL_QSPI_STATE_READY;
@@ -879,11 +878,10 @@ HAL_StatusTypeDef HAL_QSPI_Transmit(QSPI_HandleTypeDef *hqspi, uint8_t *pData, u
879878
{
880879
/* Clear Transfer Complete bit */
881880
__HAL_QSPI_CLEAR_FLAG(hqspi, QSPI_FLAG_TC);
882-
883-
#if defined(QSPI1_V1_0)
881+
882+
/* MBED, see #10049 */
884883
/* Clear Busy bit */
885884
status = HAL_QSPI_Abort(hqspi);
886-
#endif /* QSPI_V1_0 */
887885
}
888886
}
889887

@@ -968,11 +966,10 @@ HAL_StatusTypeDef HAL_QSPI_Receive(QSPI_HandleTypeDef *hqspi, uint8_t *pData, ui
968966
{
969967
/* Clear Transfer Complete bit */
970968
__HAL_QSPI_CLEAR_FLAG(hqspi, QSPI_FLAG_TC);
971-
972-
#if defined(QSPI1_V1_0)
969+
970+
/* MBED, see #10049 */
973971
/* Workaround - Extra data written in the FIFO at the end of a read transfer */
974972
status = HAL_QSPI_Abort(hqspi);
975-
#endif /* QSPI_V1_0 */
976973
}
977974
}
978975

@@ -1921,6 +1918,10 @@ HAL_StatusTypeDef HAL_QSPI_Abort(QSPI_HandleTypeDef *hqspi)
19211918

19221919
if (status == HAL_OK)
19231920
{
1921+
/* MBED, see #10049 */
1922+
/* Reset functional mode configuration to indirect write mode by default */
1923+
CLEAR_BIT(hqspi->Instance->CCR, QUADSPI_CCR_FMODE);
1924+
19241925
/* Update state */
19251926
hqspi->State = HAL_QSPI_STATE_READY;
19261927
}

0 commit comments

Comments
 (0)