How do I diagnose the DCMI communicating with a OV7670 sensor when I am not receiving data?
- October 15, 2018
- 4 replies
- 3410 views
Hello,
I am trying to get a single image the NUCLEO-L496ZG board with a OV7670 CMOS camera sensor using the DCMI HAL library.
I am trying to read a single image and write to a USB flash drive connected to the NUCLEO board.
I have been trying to use multiple sensors (MT9V024, which was outputting data, but I saw the OV7670 was supported, so I am )
I am not using an LCD screen, but I am trying to get data from the OV7670 sensor without success so far.
I added 15kohm pullup resistors on the I2C datalines.
I am using an oscilloscope to probe the I2C lines and data is going across (I2C clk line is moving , so there is a start condition happening).
I have tried using the stm32L496 Discovery board example, after compiling for my NUCLEO board without success.
I assumed there was a conflict with the BSP and the HAL libraries, so I Googled the following Github post:
https://github.com/take-iwiw/DigitalCamera_STM32/tree/e3ca40f0f960ba3888c8a9f4fec03ff328093363
I did find the DCMI main library file and I am trying to follow it step by step, but I still cannot get any parallel output data from the OV7670 sensor.
Is the following setup overview for DCMI correct using the stm32CubeMX library?
1) MX_DMA_Init();
2) MX_DCMI_Init();
3) {Write configuration registers to OV7670 camera}
4) HAL_DCMI_Start_DMA(sp_hdcmi, DCMI_MODE_SNAPSHOT, destAddress, OV7670_QVGA_WIDTH * OV7670_QVGA_HEIGHT/2);
read destAddress", which is a pointer to "cameraBuffer[320*240+10000]"
5) Write "cameraBuffer[]" array data to the USB flash drive in the "SavePicture()" function that calls "f_write()"
Questions:
1) Is the previous procedure correct for using the DCMI HAL library?
2) Do I need pullups on the DCMI pins {D0 through D7}?
3) Why is the OV7670 chip not sending data over the DCMI parallel bus?
4) If (3) cannot be answered, how do I debug the OV7670 chip sending parallel data?
I posted the DCMI stm32L4 library file and my code if anyone is able to help.
I also posted the OV7670 datasheet for reference
EDIT:
The thing that got me down this rabbit whole is that the cameraBuffer[] array is filled with NULL values when I set a breakpoint in "camera.c line#122" after the Fwrite() function call
Thank you,
Keith