I initially asked the following question on an 'answered' thread, so i suspect no one has noticed that I could use some help. That said, the other thread is still useful for reference:
http://e2e.ti.com/support/embedded/f/354/p/95683/337197.aspx#337197
Here is the general problem:
1. We are trying to use the davinci eval board in a raw mode configuration.
2. We have a custom built camera that is attaching to the VPIF, and we want to capture the raw data to the Linux filesystem
3. We are now attempting the driver mods required to get everything working in raw mode:
a. We have defined a new V4L2 standard that we call V4L2_STD_1080P_60_RAW and added it to appropriate places so it is recognized as a supported STD
b. Here is a code snipped from the modified vpif_capture.c
104 {
105 "1080P-60", 1920, 1080, 60, 1, 0, 272, 1920, 1, 42, 1122, 0,
106 0, 0, 1125, 0, 0, 1, V4L2_STD_1080P_60,
107 },
108 {
109 "1080P-60R", 1920, 1080, 60, 1, 0, 272, 1920, 1, 42, 1122, 0,
110 0, 0, 1125, 1, 0, 1, V4L2_STD_1080P_60_RAW,
111 },
c. I have included the 'normal' 1080p definition in the snippet above for comparison. Note that little else has changed. The one thing that has changed is the 16th parameter. This parameter should put the VPIF into raw mode in the configuration register discussed in the above commentary. This happens at approx line 162 in the config_vfpi_params function which resides in vpif.c.
d. The SPRUER9D data sheet has some abiguity about what interrupts are supported in raw mode.
From discussion of interrupts in raw mode on page 23:
"Two kinds of interrupt support. One is asserted once per each configured line size (line_interrupt) and the other is asserted at the end of the capture area (frame_interrupt). See Figure 10. Note that line_interrupt is only supported in raw mode. In other modes (BT.656, BT.1120, and SMPTE 296M), line_interrupt is not supported."
However, in the register description of field INTEN_FRAME_CH1 on pg 49, the documentation states:
"In raw capture mode, this bit controls the line-level interrupt enable. It depends on the value of the CH0_FORMAT bit in CH0_CTRL, if CH0_FORMAT = 3h, this bit is prepared for line-level interrupt control, if CH0_FORMAT = 0, this bit is prepared for frame level interrupt.
Since the CH0_FORMAT field determines if the device is in raw mode or not, (2h or 3h for raw mode), then it would appear that the interrupt can only be set for line mode. How does this really behave? Based on some initial evaluation of observed interrupts, it tend to think I am getting frame interrupts rather than line interrupts which isn't what I expected to see at all.
e. In the chain above, your statements lead me to believe that something would have to change in the ISR to support the raw mode. If we are getting frame interrupts hitting this ISR rather than line interrupts, what would need to be changed? I would have guessed nothing, since the action the ISR should take is to return a single buffer for user space to consume and then to schedule another buffer for kernel space to store the next captured frame.
f. My initial observations expose some problems along the way. Here is what I see:
i. We verify that our camera is outputting valid data and control signals with a scope/logic analyzer. This is measured between the mux and the processor on the back of the davinci evaluation board. This leads me to believe the camera is doing the right thing.
ii. We connect the camera to the VPIF, and point it at a bright light and start the VPIF. The first 46 or so lines come back as 0xFF; the rest of the lines come back as zero.
iii. We put our hand over the camera lens and execute the capture code once more. The first 46 or so lines come back as some very small number, (the number is exactly the same
iv. We command the camera to display a test image, (ramp data), and execute the command once more. We get zeros for the entire frame when there should have been consistently incrementing numbers.
v. My initial guess at what is happening is that the DMA controller is getting the first pixel/value and writing it to SDRAM many times, and then eventually quits or gives up without writing any new updated values. Do you have any idea what could cause the VPIF to behave in this manner? I have checked the values that are being set in the CH0_TOP_START_ADD_LUMA and it seems sane. Same with the CH0_IMG_ADD_OFST register; it seems to be set correctly as well. My understanding is that when in raw mode almost all other registers will be ignored.
4. There is clearly a bug at ~line 178 in vpif.c in function config_vpif_params. The line of code:
176 value &= ((~(unsigned int)(0x3)) <<
177 VPIF_CH_DATA_WIDTH_BIT);
The bitwise not should not be executed before the SLL. This leads to the value being bitwise and'ed with something that has zeros after the bits of interest. It ends up clobbering important configuration bits.
Thanks much for the help,
Nate Jensen
Space Dynamics Lab