I am attempting to set up the Video Port to acquire 720x480 8-bit BT.656 video data, continuously, using a DM642. I can almost get it to work, except there is something I just can't get to work correctly. I want to convert the input 4:2:2 and generate output 4:2:0 frames. I figure the easiest way to do this for the luminance channel is to use two EDMA parameters, one for each field, and use the index value to interlace the two fields into one, composite frame; essentially, the even rows of the interlaced output frame would come from field 1, while the odd rows would come from field 2. For the chroma channels, because I only need every other line, I'll just use the field 1 data, which neatly decimates the rows by the required factor of two to realize the 4:2:2 -> 4:2:0 conversion. Finally, because I need to do this continuously, I want to set up a double-buffered (aka ping-pong) scheme (I may eventually end up with triple-buffered, round-robin, if necessary, but for purposes of this discussion, assume the double-buffer approach.)
To accomplish this scheme, I have set up four EDMA parameter tables for each of the three video planes (e.g. luminance and two chroma); in each case, the four parameter tables correspond to four consecutive fields that are encountered when receiving two consecutive frames. These tables are linked together in a circle, thus setting up the double-buffer. Finally, the thinking is to have the EDMA generate an interrupt at the end of every field 2 on the luminence channel to serve as an indicator to the DSP on when it should switch to reading the just filled frame.
So far, it seems the basic concept above is valid, and almost works, but I’ve run into two, probably inter-related, problems. The first symptoms, other than no and/or bad data, are that the video port is reporting a very large number of FIFO overflows, and hence, a very large number of interrupts are being caused – several hundred per frame! Furthermore, I cannot get what I want from the EDMA - specifically, an interrupt when each complete frame has been transferred into memory; instead, I get either one per row or another number I can’t correlate to anything!
On the FIFO overflows, I am quite confused on these, as I would think the EDMA is fast enough to keep up with the video port! The four tables for each plane are linked together (the LINK bit is set), and TCINT and TCC fields are set, so it would appear the EDMA should be continually updating its operation properly. The element size is set to 32-bits, the ELECNT field is set to correspond to one row of pixels – specifically, 720 / 4 = 180 for luminance, or 360 / 4 = 90 for the chroma planes. The FRMCNT field is set to 239, which is the number of rows per field, minus 1. So it seems each entry handles exactly one field of the associated plane. So I cannot understand why the video port is detecting FIFO overflows! (I am pretty sure the Video Port is programmed for the correct video size.)
The excessive interrupts are another matter. I originally used the value 0x40ba0002 for the OPT value, which sets the LINK bit and other bits appropriately; however, I got a crazy number of interrupts. A little investigation in the EDMA manual suggested I try setting the FS bit, but that didn’t seem to work – I am still seeing an interrupt per row!
A typical table looks like this:
OPT: 0x40ba0002
SRC: 0x74000000 <- Video Port 0
CNT: 0x00ef00b4 <- 240 rows, 180 words (4 pixels each)
DST: 0x80800100
IDX: 0x05a00000 <- Skips every other row in destination
RLD: 0x00000630 <- points to next table
Any ideas?