cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7A3 and camera problems

Matjaz Tome
Associate

Hello,

I have a STM32H7A3 dev board (NUCLEO-H7A3ZI-Q) and have connected it to a OV7670 camera using DCMI interface. I used an example from Cube library (for DCMI) that grabs single image from camera and stores it in the internal RAM of a microcontroller. That part seems to work just fine, as the expected numbers of pixels actually get stored in the memory.

Then I wrote a simple Python script that receives that data throu UART and draws a picture.

The pictures I get are really strange (see attached photo). If i set my camera module to transmitt test patern, the bars are there, but the collors are different from what is expected.

This is the code that takes raw data from camera module and changes them to 3 8-bit varaibles (r, g, b):

 

 

 

static void data_to_rgb (uint8_t *in_data, uint8_t* r, uint8_t *g, uint8_t *b)
{
	uint8_t g_lower = 0;
	g_lower = (*(in_data + 1) & 0xE0) >> 3;
	*r = (*(in_data)) & (0xF8);
	*g = ((*(in_data) & 0x07) << 5 | g_lower);
	*b = (*(in_data + 1) & 0x1F)  << 3;

}

 

 

 

 

in_data is a pointer to memory where a data from camera is stored and r, g, b are pointers for r, g and b values of pixels. Camera is setup to transmitt data in RGB format at reolution of 320 x 240 pixels.

Any ideas what could be wrong?

0 REPLIES 0