Can not get image from CYUSB3KIT (fx3) ov5640

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
xihoc_3044746
Level 1
Level 1

hi,

I'm using CYUSB3KIT-003 uvc project with ov5640. GPIF II interface shows in 'gpif.png' and its state machine unchanged.

ov5640 i2c probe and initializing was copy from my old CY7C68013A project which works ok. The wave shows in 'ov5640.png'.

I got wrong wave using the same i2c registers config (see SensorInit.txt from my code).

I2C config ov5640 to stream raw 640x480 bayer. Usb descriptor (cyfxuvcdscr.c) show in 'usb.txt'.

But I see black image using windows camera application.

I capture usb commucation with wireshark show all 0xFF values in 16kb transfermation (shows in 'cap.png' and 'uartlog.txt').

According to "001-92220_AN75779_How_to_Implement_an_Image_Sensor_Interface_with_EZ-USB_FX3_in_a_USB_Video_Class_UVC_Framework_Chinese.pdf",

My cmos sensor is 8bit width, so LD_DATA_COUNT and LD_ADDR_COUNT in GPIF II state machine is set to 16367. (=16368/(8/8)-1). Is this right?

Please help me to find out what is missing or mistaken.

Another thing puzzle me is that why the uvc project can't transfer raw data captured from gpif ports to usb host directly, even the image is broken.

I think if raw data comes to my application, I can debug that without troubling by the fx3.

Thanks

0 Likes
6 Replies
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

I notice in your /* Class specific Uncompressed VS frame descriptor */ that the /* Width in pixel 640 */ is coded as 0x02, 0x80. can you change it to 0x80, 0x02 and test?

Regards,

Hemanth

Hemanth
0 Likes

Thanks for your reply. I'll fix uvc descriptor and try.

Another thing I found using logic viewer is that my PCLK seems confusion. The I2C config code works well on CY7C68013A. It run about four times faster on FX3, but looks ok.

1.PNG

0 Likes

0x80, 0x02  is 640. I fix the mistake.  I set gpif 'clock setting' to 'external' the PCLK look like good. Every HREF activation has 640 PCLK rise.

1.PNG

0 Likes
xihoc_3044746
Level 1
Level 1

I still can't get image.   I add the following code in uvc.c / CyFxUvcApplnDmaCallback after CyFxUVCAddHeader called.

if (glFrameCount>100)

{

    uint8_t *buffer_p1=dmaBuffer.buffer;

    CyU3PDebugPrint (4, "%x %x %x %x %x %x %x %x \r\n", buffer_p1[0],buffer_p1[1],buffer_p1[2],buffer_p1[3],

            buffer_p1[4],buffer_p1[5],buffer_p1[6],buffer_p1[7]);

}

It prints some FF and stops running. And if I modify buffer_p1, the usb capture shows what I have modified.

So, the 'usb side' seems ok, but the gpif (or dma) side.

Please help me in the GPIF state machine setting.

0 Likes

Hi,

Please do not place DebugPrint in dma callback.

You mentioned that USB side is okay. Did you check if the FV, LV and PLCK waveform is okay?

In UART debug prints are you getting any error messages now?

Verify whether you are getting correct number of full DMA buffers (along with one partial buffer) for one frame of data.

Regards,

Hemanth

Hemanth
0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

If the issue still persists, please post the schematic part showing the interface between FX3 and Image sensor.

And probe the data line and check whether you are getting 0xFF/non-0xFF data.

Regards,

Hemanth

Hemanth
0 Likes