Bug in GPDMA with 2D addressing (I think)
I believe there's a bug in the stm32h7rsxx_hal_dma code for dealing with repeated blocks in interrupt mode. This bug probably exists in other STM32H7 devices as well.
With a typical repeating transfer, in *NON* interrupt mode, the DMA transfer completes successfully, and the DMA state ends up in HAL_DMA_STATE_READY, ready for another request. All is well.
However, in interrupt mode, the DMA transfer completes successfully (all data is correctly transferred), but querying the DMA state in the DMA Transfer Complete callback, you'll get HAL_DMA_STATE_BUSY. In fact, it will remain in this state forever.
Looking at the stm32h7rsxx_hal_dma.c code, the block starting at 1154 ("Transfer Complete Interrupt management"). There are really only two cases where the HAL_DMA_STATE_READY can be set:
1) LinkedList mode (not relevant to us)
2) "Normal transfer" where CBR1 == 0. (i.e. not a repeating block transfer) In a repeating transfer, CBR1 contains the repeating config, and is generally not 0 (it's called the "Alternate Block Register 1").
So, a repeating block transfer can seemingly never get back to HAL_DMA_STATE_READY with a repeating transfer.
You can reproduce this problem starting with the DMA_RepeatedBlock demo incremented gather operation.
I'm not entirely sure of the fix here. Perhaps it's checking if we're in a repeating block transfer and assuming that's also a "normal transfer"?
