DCMI or DMA problem. Detecting end of capture
Hello,
I am facing strange problem. I have a camera that transfers data, 90kPixels.
Since it is 10 bit camera, and data is packed into 32b word, I can tranfare image in singe DMA config ((300x300)/2 in DMA)
So I have Circular DMA buffer, continuous DCMI capture mode, and HSYNC, FRAME, DMA_TC IRQ's Enabled. I get perfect test paters and test data, so all is fine here with communication !
After image is captured, I start to do some image recognition.
Problem Is I get different behaviors (response in processed data on static image) if i use TC interrupt, frame interrupt, or VSYNC interrupt. All of them should be in time, where data has been transferred, but it's not. I can get IRQ's when DMA says data is not transferred yet, or i get corruption in half of frame, like overexposed frame. So my calculations would start to jump all over the place.
Any idea what could be wrong here? why is is a difference for calculated data, if DMA has highest priority and I am doing math from array start? even if it's not transferred, and few pixels left, in the time i process data all will be correct SRAM spot ( I am using internal SRAM)
Capture is done in this way. I have timer that triggers camera, and i have global variable that tracks status, if status is zero, I trigger camera, and DCMI/DMA starts it's job, no register edit needed. And when I get TC, VSYNC, FRAME interrupt, I change status to "capture_Done" value.
In main, i have while(1) cycle that tracks capture_Done value, and if value is triggered, it does the job, and at the end of job resets it to zero. So if my task is not doe after timer tries to trigger camera, i will skip the frame and get FPS/2 operation. No extra attention is needed.
At the moment i am running at 60-80% duty cycle.
