Advertisement
edensheiko

stm32 spi fifo bug

Mar 9th, 2024
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | Source Code | 0 0
  1. /* NOTICE: for transmit with DMA a bug fix was needed, please see file
  2.      *         core/src/stm32f7xx_it.c in function DMA2_Stream4_IRQHandler
  3.      *         at line ~ 370
  4.  */
  5.  
  6. void DMA2_Stream4_IRQHandler(void)
  7. {
  8.   /* USER CODE BEGIN DMA2_Stream4_IRQn 0 */
  9.  
  10.   /* BUG FIX --------------------------------------------------------------*/
  11.   /* When using SPI with DMA in direct mode there is a known bug in
  12.    * the hal library - The function HAL_SPI_Transmit_DMA enables fifo error
  13.    * interrupts even when there is NO fifo and thus causing fifo error
  14.    * interrupts to occur with NO fifo
  15.    */
  16.   if(hdma_spi5_tx.Init.FIFOMode != DMA_FIFOMODE_ENABLE)
  17.   {
  18.       /* Disable fifo error interrupt, they shouldn't even be on... */
  19.       __HAL_DMA_DISABLE_IT(&hdma_spi5_tx, DMA_IT_FE);
  20.   }
  21.  
  22.   /* USER CODE END DMA2_Stream4_IRQn 0 */
  23.   HAL_DMA_IRQHandler(&hdma_spi5_tx);
  24.   /* USER CODE BEGIN DMA2_Stream4_IRQn 1 */
  25.  
  26.   /* USER CODE END DMA2_Stream4_IRQn 1 */
  27. }
Tags: STM STM32
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement