QSPI erratum "fix" not applicable to stm32L496 Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
faisal
Posts: 278
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 37 times
Been thanked: 37 times

QSPI erratum "fix" not applicable to stm32L496  Topic is solved

Postby faisal » Sat Apr 03, 2021 8:51 pm

The fix here: viewtopic.php?f=35&t=5602 , is not applicable to L496. The errata sheets are different with regards to QSPI for L476/486 and L496 .

I tested with and without the errata patch applied, and using the version that 'addresses' the errata doesn't work on L496. It results in the wspi read function hanging waiting to be resumed from the ISR.

We need to selectively include the errata "fix" depending on specific model.

https://www.st.com/resource/en/errata_s ... ronics.pdf

https://www.st.com/resource/en/errata_s ... ronics.pdf

faisal
Posts: 278
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 37 times
Been thanked: 37 times

Re: QSPI erratum "fix" not applicable to stm32L496

Postby faisal » Sun Apr 04, 2021 1:16 am

I checked all the errata for the L4 series (https://www.st.com/en/microcontrollers- ... umentation). There are 12 errata published for the different devices in the series. Below is the applicable patch targeting those devices that have the "Extra data written in the FIFO at the end of a read transfer" bug.

diff --git a/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c b/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
index 678339a02..8ef9ba7d1 100644
--- a/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
+++ b/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
@@ -95,6 +95,7 @@ static void wspi_lld_serve_interrupt(WSPIDriver *wspip) {
while (dmaStreamGetTransactionSize(wspip->dma) > 0U)
;

+#if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L486xx)^M
/* Handling of errata: Extra data written in the FIFO at the end of a
read transfer.*/
if (wspip->state == WSPI_RECEIVE) {
@@ -102,6 +103,7 @@ static void wspi_lld_serve_interrupt(WSPIDriver *wspip) {
(void) wspip->qspi->DR;
}
}
+#endif^M
}

/*===========================================================================*/

User avatar
Giovanni
Site Admin
Posts: 13527
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 861 times
Been thanked: 743 times
Contact:

Re: QSPI erratum "fix" not applicable to stm32L496

Postby Giovanni » Sun Apr 04, 2021 2:30 am

Hi,

Thanks for finding, will fix ASAP.

Giovanni

faisal
Posts: 278
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 37 times
Been thanked: 37 times

Re: QSPI erratum "fix" not applicable to stm32L496

Postby faisal » Sun Apr 04, 2021 4:49 am

The actual diff on my end is below. I was missing the dmaStreamClearInterrupt(wspip->dma) - which was added in the last month as a bug fix. However, that didn't fix the problem. I kept that, but removed the errata handling and added back the dmaStreamDisable from the previous revision. That seems to work.

diff --git a/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c b/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
index 678339a02..18dc6c970 100644
--- a/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
+++ b/ChibiOS_20.x.x/os/hal/ports/STM32/LLD/QUADSPIv1/hal_wspi_lld.c
@@ -95,6 +95,11 @@ static void wspi_lld_serve_interrupt(WSPIDriver *wspip) {
while (dmaStreamGetTransactionSize(wspip->dma) > 0U)
;
+ /* Clearing DMA interrupts here because the DMA ISR is not called on
+ transfer complete.*/
+ dmaStreamClearInterrupt(wspip->dma);
+
+#if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L486xx)
/* Handling of errata: Extra data written in the FIFO at the end of a
read transfer.*/
if (wspip->state == WSPI_RECEIVE) {
@@ -102,6 +107,9 @@ static void wspi_lld_serve_interrupt(WSPIDriver *wspip) {
(void) wspip->qspi->DR;
}
}
+#else
+ dmaStreamDisable(wspip->dma);
+#endif
}

/*===========================================================================*/

User avatar
Giovanni
Site Admin
Posts: 13527
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 861 times
Been thanked: 743 times
Contact:

Re: QSPI erratum "fix" not applicable to stm32L496

Postby Giovanni » Sat Apr 24, 2021 6:14 am

Hi,

Fixed bug as #1153.

Now the code in 20.x and 19.x is equal to the trunk.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests