DCMI interface doubles the image
Hello,
I'm working on a DCMI to USB video class converter which runs on a STM32L496. The image sensor is a custom grayscale level sensor developed by my institution. It is 640x480, 8 bit per pixel, however to simplify the things I configured the DCMI interface to select only 1 line out of two and same for the pixel (I use DCMI_LSM_ALTERNATE_2 and DCMI_BSM_ALTERNATE_2 during DCMI initialization).
The problem is that when I monitor the image using VLC the image is weird (see below) and I can't find the source of the problem.

What I see are two problems (that might be only one having two consequences):
- one pixel out of two is black
- the image looks folded on itself
In fact you can see the tip of my fingers on the right of the image while the 'body' of the finger is in on the left, and when I move the hand I see these things overlapping.
Another weird fact that might help finding issues is that if I configure the DCMI interface to sample one frame out of four (DCMI_CR_ALTERNATE_4_FRAME), it generates the HAL_DCMI_LineEventCallback even for lines belonging to the skipped frames. In other words for each call to HAL_DCMI_FrameEventCallback, I get 1920 calls to HAL_DCMI_LineEventCallback (and not 480 as I expected).
Do anybody have ever seen similar effects?
Is it normal that HAL_DCMI_LineEventCallback do not skip events of discarded frames?
Any other idea?
Thank you,
Davide.
