Apparently a conflict when clearing TC flags of DMA2 Streams
Hello to all, I hope you and your families are safe and sound.
I am working to improve my project based on the STM32F469 MCU, but now I am experiencing a weird behavior. I can't post the code of course, too many files connected, so I will try to explain what happens hoping that this can light up some idea on how to solve it.
This system has:
- VGA port with a 12 bit resistor DAC connected to GPIOB. The video signal is generated thanks to a PWM signal for the HSync, This trigs the TIM8 that drives the DMA2Stream1 channel7, and transfers uint16_t words from a frame buffer to the GPIOB peripheral. The mode set is Memory to Peripheral. Every scanline is counted with the TIM2 interrupt that handles all operations used to prepare the settings of the DMA transfer for pixels.
When the DMA2Stream1 starts, trigged by the TIM8 activated by TIM2 PWM, the words of the colors are trensferred from SRAM to GPIOB. When the NDTR reaches 0 the DMA2Stream1 IRQ is fired, and here the DMA2Stream1 is disabled, the addresses are updated etc, then everything goes on for the next scanline.
- 2 LCD ports, connected to the FMC bus, using FMC_NORSRAM_BANK1. Both of them use an 8080 8bit parallel port, CS-RST-WR-RD-C/D signals are connected to the FMC and Address lines so that it's possible to write data on LCDS at different addresses of the FMC.
Two buffers are set on the SDRAM, on FMC of course, and pixel data are trensferred from SDRAM to FMC_NORSRAM_BANK1 through DMA2Stream4 and DMA2Stream5 line by line from 0 to 239 (240 lines of the LCD) . The mode used is Mem2Mem. Every TC the IRQ is fired and addresses are updated like what happens to the VGA driver.
That said, the VGA signal works, the transfer of pixels data from SDRAM to LCDs works. BUT separately, not at the same time. Example. The VGA video starts, I load two images from the SD card to SDRAM, then I start the transfer with DMA2Streams4/5 and as soon as the TC flag is cleared in the IRQ routines of those streams, some how, the DMA2Stream1 of the VGA stops. The IRQ of the VGA is not fired anymore.
If I don't start the LCDs image refresh the VGA goes well. After several tests I saw that the problem happens when the TC flags of DMA2Stream4/5 are cleared by setting HISR registers. If I don't clear them, of course the DMA transfers of the LCDs stop, but the VGA is not affected and goes on perfectly.
I can't understand why clearing those flags the IRQ of the other stream is not fired anymore.
I hope to have explained it well.
Thanks