I'm struggling with OV7670 camera and still can't get proper images out of it...
I want to get a 256x256 monochrome pixel region. Camera operates in YUV422 mode so I'm aimed at a higher 8-bits part of the 16-bit output. With that said, I'm having the following:
- all pads configured as pulled-up inputs; VSYNC inverted, interrupt attached.
- clocking @ 20MHz or 40MHz via LEDC
- D0...D7 MUXed to appropriate I2S signalling
- camera module is missing HREF pad so I'm using HSYNC instead
- windowing consigured as per datasheet (HSTART, VSTART, HSTOP, VSTOP, HREF)
- test grayscale mode activated
- I2S has the following capturing config:
-- I2S0.conf.rx_right_first = 0;
-- I2S0.conf.rx_msb_right = 0;
-- I2S0.fifo_conf.rx_fifo_mod = 1;
Hence I expect to get the byte flow: CAMERA = s1, s2, s3, s4, ... FIFO = 00 s1 00 s2, 00 s3 00 s4, ... (shown in many source files on github).
FIFO/DMA configured to fill the temporary junkBuffer with 4096 words (16834 bytes). Later on I pick up the luma bytes from there.
RESULTS:
(a) the junkBuffer reads this (the first 32 bytes are shown per frame):
Code: Select all
54 00 54 00 86 00 86 00 54 00 54 00 86 00 86 00 54 00 54 00 86 00 86 00 54 00 54 00 86 00 86 00
A5 00 A5 00 9D 00 9D 00 A5 00 A5 00 9D 00 9D 00 A5 00 A5 00 9D 00 9D 00 A5 00 A5 00 9D 00 9D 00
B6 00 B6 00 B2 00 B2 00 B6 00 B6 00 B2 00 B2 00 B6 00 B6 00 B2 00 B2 00 B6 00 B6 00 B2 00 B2 00
A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00 A0 00
86 00 86 00 54 00 54 00 86 00 86 00 54 00 54 00 86 00 86 00 54 00 54 00 86 00 86 00 52 00 52 00
(2) I ran 4 different scenarios and picked up every N-th byte (0...3) from the junkBuffer and got the following images:
Once (on a very rare occasion) I happened to get a more or less structured pattern:
(3) The picures above were generated by the camera with a terrible 20cm wiring. In hope to cut off the possible noise I reassembled the design replacing signal wires with a thick short soldered pins wrapped in isolator. VCC/GND/SDA/SCL/RESET and PWDN are left untouched.
Such a modification did not yield any positive result however