Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMA HAL enables FIFO Error interrupt even if the FIFO is not enabled #76

Open
multiplemonomials opened this issue Sep 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working dma DMA-related issue or pull-request. hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system st community Also reported by users on the community.st.com

Comments

@multiplemonomials
Copy link

Describe the set-up

  • NUCLEO_H743ZI2
  • arm-none-eabi-gcc 13.2.1

Describe the bug
Working on the mbed-ce/mbed-os DMA SPI code for STM32H7, I observed that my code was going into the DMA error ISR handler during DMA transfers. This happened intermittently and for no apparent reason, and the error bit was the FIFO error flag. Eventually I found this forum thread that described the issue and the fix well. Basically, the FIFO error flag can set under "nominal" conditions just due to the DMA controller having issues acquiring the MCU internal bus.

While this can indicate that perhaps you need to enable the FIFO or reduce bus contention in your project, it is not an error that should fail the DMA transfer, I believe. For my application, I simply turned off the error flag and saw perfect behavior. (it probably helps that the SPI peripheral has its own FIFO so data won't be immediately lost of this happens

How To Reproduce
Unfortunately I don't have an easy way to reproduce this one, but me and that person on the forum both had it occur during "normal" application operation. In my case, it was happening when I was doing DMA SPI transfers with a pretty standard configuration (DMA controller in direct mode).

Additional context
In my application, I fixed it by changing this line to:

      // Only enable FIFO error if FIFO is enabled (direct mode disabled).
      // In direct mode this flag can set spuriously due to bus contention.
      if(((DMA_Stream_TypeDef *)hdma->Instance)->FCR & DMA_SxFCR_DMDIS)
      {
        ((DMA_Stream_TypeDef *)hdma->Instance)->FCR |= DMA_IT_FE;
      }

This way the FE flag will not generate an error interrupt if the DMA

@ALABSTM ALABSTM added bug Something isn't working hal HAL-LL driver-related issue or pull-request. st community Also reported by users on the community.st.com dma DMA-related issue or pull-request. labels Sep 23, 2024
@ALABSTM ALABSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Oct 4, 2024
@ALABSTM ALABSTM moved this from To do to Analyzed in stm32cube-mcu-hal-dashboard Oct 4, 2024
@ALABSTM
Copy link
Collaborator

ALABSTM commented Oct 4, 2024

ST Internal Reference: 192903

@ALABSTM
Copy link
Collaborator

ALABSTM commented Oct 4, 2024

Hi @multiplemonomials,

Thank you for your report. The point looks relevant. It has been reported to our development teams. Let's wait for their feedback.

With regards,

vishwamartur added a commit to vishwamartur/stm32h7xx-hal-driver that referenced this issue Nov 2, 2024
Related to STMicroelectronics#76

Add condition to enable FIFO Error interrupt only if FIFO is enabled.

* Modify `Src/stm32h7xx_hal_dma_ex.c` to check if FIFO is enabled before enabling FIFO Error interrupt.
* Add condition to line 292 to enable FIFO Error interrupt only if FIFO is enabled (direct mode disabled).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dma DMA-related issue or pull-request. hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system st community Also reported by users on the community.st.com
Projects
Development

No branches or pull requests

3 participants