diff --git a/demos/STM32/RT-STM32H750XB-DISCOVERY/cfg/halconf.h b/demos/STM32/RT-STM32H750XB-DISCOVERY/cfg/halconf.h index a2ea0b094..cdbad17f1 100644 --- a/demos/STM32/RT-STM32H750XB-DISCOVERY/cfg/halconf.h +++ b/demos/STM32/RT-STM32H750XB-DISCOVERY/cfg/halconf.h @@ -198,7 +198,7 @@ * @brief Enables the WSPI subsystem. */ #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) -#define HAL_USE_WSPI TRUE +#define HAL_USE_WSPI FALSE #endif /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/QUADSPIv2/hal_wspi_lld.c b/os/hal/ports/STM32/LLD/QUADSPIv2/hal_wspi_lld.c index 5d252d97d..7f9cb1aea 100644 --- a/os/hal/ports/STM32/LLD/QUADSPIv2/hal_wspi_lld.c +++ b/os/hal/ports/STM32/LLD/QUADSPIv2/hal_wspi_lld.c @@ -73,7 +73,8 @@ static void wspi_lld_serve_mdma_interrupt(WSPIDriver *wspip, uint32_t flags) { (void)wspip; (void)flags; - if (wspip->state == WSPI_RECEIVE) { + if (((flags & STM32_MDMA_CISR_CTCIF) != 0U) && + (wspip->state == WSPI_RECEIVE)) { /* Portable WSPI ISR code defined in the high level driver, note, it is a macro.*/ _wspi_isr_code(wspip); @@ -82,7 +83,7 @@ static void wspi_lld_serve_mdma_interrupt(WSPIDriver *wspip, uint32_t flags) { } /* DMA errors handling.*/ #if defined(STM32_WSPI_MDMA_ERROR_HOOK) - if ((flags & STM32_MDMA_CISR_TEIF) != 0) { + else if ((flags & STM32_MDMA_CISR_TEIF) != 0) { STM32_WSPI_MDMA_ERROR_HOOK(wspip); } #endif @@ -233,7 +234,6 @@ void wspi_lld_send(WSPIDriver *wspip, const wspi_command_t *cmdp, STM32_MDMA_CTCR_DINC_FIXED | /* Destination fixed. */ STM32_MDMA_CTCR_SINC_INC; /* Source incremented. */ uint32_t ccr = STM32_MDMA_CCR_PL(STM32_WSPI_QUADSPI1_MDMA_PRIORITY) | - STM32_MDMA_CCR_CTCIE | /* On transfer complete.*/ STM32_MDMA_CCR_TEIE; /* On transfer error. */ /* MDMA initializations.*/ @@ -361,17 +361,20 @@ void wspi_lld_unmap_flash(WSPIDriver *wspip) { * @param[in] wspip pointer to the @p WSPIDriver object */ void wspi_lld_serve_interrupt(WSPIDriver *wspip) { + uint32_t sr; - wspip->qspi->FCR = QUADSPI_FCR_CTEF | QUADSPI_FCR_CTCF | - QUADSPI_FCR_CSMF | QUADSPI_FCR_CTOF; + sr = wspip->qspi->SR; + wspip->qspi->FCR = sr; - if (wspip->state == WSPI_SEND) { + if (((sr & QUADSPI_FCR_CTCF) != 0U) && (wspip->state == WSPI_SEND)) { /* Portable WSPI ISR code defined in the high level driver, note, it is a macro.*/ _wspi_isr_code(wspip); mdmaChannelDisableX(wspip->mdma); } + + /* TODO errors handling.*/ } #endif /* HAL_USE_WSPI */