Skip to main content
Associate II
November 21, 2023
Solved

STM32-L4A6 with OV5640

  • November 21, 2023
  • 5 replies
  • 11743 views

Hello Community!
I am a newcomer to STM and am currently trying to control the OV5640 with the STM32-L4A6 (NUCLEO-L4A6ZG).

Unfortunately I have no success and cannot establish communication. I am biting my teeth out and am in urgent need of support. I am using the developer board from Adafruit (https://learn.adafruit.com/adafruit-ov5640-camera-breakout/overview).

Does anyone have an example project or can help me in any other way?
I would be very grateful!

Thank you very much and have a nice day.
Kind regards

Nicola

Best answer by Tesla DeLorean

Perhaps look at DISCO and EVAL board level implementations of DCMI either for the L4+, or other related STM32

https://www.st.com/content/ccc/resource/training/technical/product_training/group0/ec/99/3b/61/b3/96/49/1b/STM32H7-Peripheral-Digital_Camera_Interface_DCMI/files/STM32H7-Peripheral-Digital_Camera_Interface_DCMI.pdf/_jcr_content/translations/en.STM32H7-Peripheral-Digital_Camera_Interface_DCMI.pdf

Get an I2C interface up so you can communicate with the camera.

Make sure you can get to the DCMI pins on the NUCLEO, and there aren't any conflicted pins. Grab the schematic from the "CAD Resources" tab of the board page. The data manual for the chip should enumerate the DCMI pins.

5 replies

Visitor II
November 21, 2023

Are you using these resources here?

https://github.com/STMicroelectronics/stm32-ov5640

nicola3Author
Associate II
November 21, 2023

Hi liafiat85

Unfortunately i clicked the solution button :grinning_face_with_sweat:. Yeah it considered using these ressources. The problem is that I am not able to communicate with the I2C and the DCMI. Because this is all new to me and I tried it so many times, but always failed.
Can you help me with this problem?

Visitor II
November 21, 2023

I am not sure how much it will help you. Here is a documentation on DCMI on STM32:

https://www.st.com/resource/en/application_note/an5020-digital-camera-interface-dcmi-on-stm32-mcus-stmicroelectronics.pdf

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
November 21, 2023

Perhaps look at DISCO and EVAL board level implementations of DCMI either for the L4+, or other related STM32

https://www.st.com/content/ccc/resource/training/technical/product_training/group0/ec/99/3b/61/b3/96/49/1b/STM32H7-Peripheral-Digital_Camera_Interface_DCMI/files/STM32H7-Peripheral-Digital_Camera_Interface_DCMI.pdf/_jcr_content/translations/en.STM32H7-Peripheral-Digital_Camera_Interface_DCMI.pdf

Get an I2C interface up so you can communicate with the camera.

Make sure you can get to the DCMI pins on the NUCLEO, and there aren't any conflicted pins. Grab the schematic from the "CAD Resources" tab of the board page. The data manual for the chip should enumerate the DCMI pins.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
nicola3Author
Associate II
November 21, 2023

I have already a code for the adafruit, but it is for an stm32-f4 and so I can't implement it to my STM32-L4. Do you know a workaround or how i can adapt this (see: https://www.waveshare.com/wiki/OV5640_Camera_Board_(A) -> code).

Tesla DeLorean
Guru
November 21, 2023

>>Because this is all new to me and I tried it so many times, but always failed.

Unfortunately that communicates very little detail.

What specifically have you tried? Perhaps describe in a document, as to what exactly was tried, what the observations were. What you checked with a scope or logic analyzer.

How is this wired up, what I2C interface is it connected too? What code have you used to communicated via I2C? Show the code.

Start with the I2C. There should be far more examples of that.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
nicola3Author
Associate II
November 23, 2023

Hi Community!

I found out, that even the communication of the STM to the OV5640 doesn't work. I couldn't get the ID of the Camera with I2C.

When i run the Init-loop in main.c in the file ov5640.c I'm not able to read from the register the default values (0x56 and 0x40, see code down below or in attachment). I connected the SDA to the GPIO B9 and the SCL to the B8. My reg does not get the 0x5640, it receives 0xffff.

Does anyone know why?

Thank you in advance!

 

Code:

uint16_t i=0;

uint16_t reg;

OV5640_POWER_ON; // Power on 

HAL_Delay(30);

reg=OV5640_RD_Reg(OV5640_CHIPIDH); // default value: 0x56

reg<<=8;

reg|=OV5640_RD_Reg(OV5640_CHIPIDL); // default value: 0x40

if(reg!=OV5640_ID){

   printf("ID: %d \r\n",reg);

   return 1;

}

 

nicola3Author
Associate II
November 26, 2023

I managed it to work. Thank you all for your help!

Visitor II
May 28, 2025

Hi!

I am currently working on a similar project and trying to get the OV5640 camera to livestream to an LCD screen using the STM32L476rgt6. I was wondering what you did to solve your issue? Also, I took a look at your code, were the sccb.c and sccb.h files code that you wrote to manually adjust the registers to simulate the sccb behavior without using the I2C hardware on the board?

Thanks!