copy paste typo in SPIV3 (H7) driver. Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
alex31
Posts: 380
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

copy paste typo in SPIV3 (H7) driver.  Topic is solved

Postby alex31 » Wed Nov 01, 2023 8:39 am

Hello,

On stm32H7, SPI is connected to BDMA, it's managed by the driver, but there is copy paste typo in a dbgAssert check, so the app run fine without assert, but fail when they are in use.

Here is the patch for ChibiOS 21.11.x current.

Code: Select all

diff --git a/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c b/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c
index f0ef28d6d..14dcadf37 100644
--- a/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c
+++ b/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c
@@ -599,12 +599,12 @@ void spi_lld_start(SPIDriver *spip) {
                                       STM32_SPI_SPI6_IRQ_PRIORITY,
                                       (stm32_dmaisr_t)spi_lld_serve_bdma_rx_interrupt,
                                       (void *)spip);
-      osalDbgAssert(spip->rx.dma != NULL, "unable to allocate stream");
+      osalDbgAssert(spip->rx.bdma != NULL, "unable to allocate stream");
       spip->tx.bdma = bdmaStreamAllocI(STM32_SPI_SPI6_TX_BDMA_STREAM,
                                       STM32_SPI_SPI6_IRQ_PRIORITY,
                                       (stm32_dmaisr_t)spi_lld_serve_bdma_tx_interrupt,
                                       (void *)spip);
-      osalDbgAssert(spip->tx.dma != NULL, "unable to allocate stream");
+      osalDbgAssert(spip->tx.bdma != NULL, "unable to allocate stream");
       rccEnableSPI6(true);
       bdmaSetRequestSource(spip->rx.bdma, STM32_DMAMUX2_SPI6_RX);
       bdmaSetRequestSource(spip->tx.bdma, STM32_DMAMUX2_SPI6_TX);


Alexandre

User avatar
alex31
Posts: 380
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: copy paste typo in SPIV3 (H7) driver.

Postby alex31 » Wed Nov 01, 2023 9:12 am

Note that the problem is in the V1 driver, not in the more recent V2 driver.
A.

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

Re: copy paste typo in SPIV3 (H7) driver.

Postby Giovanni » Wed Nov 08, 2023 9:43 am

Hi,

Fixed in trunk.

Any reason for using v1?

Giovanni

User avatar
alex31
Posts: 380
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 62 times
Contact:

Re: copy paste typo in SPIV3 (H7) driver.

Postby alex31 » Tue Nov 14, 2023 11:14 pm

Hi,
Any reason for using v1?


Don't know yet :-)
Have to ask other dev that made the choice, but Ardupilot and Paparazzi are using V1 for accessing invensense IMU at high rate
Will try to revert to v2 in Paparazzi to see if it breaks things or not.

Alexandre


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests