This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5726: Image capture with 16bpp

Part Number: AM5726
Other Parts Discussed in Thread: AM5728

Linux RT kernel v4.19 from SDK 6.0

Hello,

we use an AM5726 with an fpga connected to an video input port with 16 bit. The fpga transfers the pixels from a monochrome image sensor from the LVDS channels to 8 or 16 bit parallel format
for the video input port. This works for 8 bit per pixel but now I would like to transfer 16 bit per pixel from the vip to the RAM. But also with the modifications decribed below, I still
get the 8bpp raw image in the RAM. I currently use Linux RT kernel 4.19 from SDK 6.0. Could someone please review my configuration steps and maybe tell me what is missing.


So first I used the device tree from Beagleboard as template and adapted the configuration for my board.
Here e2e.ti.com/.../759666 I read that bus-width = <16> should be set but there was no exact information, where it should be set. So I set it everywhere
in the vip2 configuration. Could you tell me where to set this paramater.

#include "am57xx-beagle-x15-common.dtsi"

.........

&mcspi1 {
status = "okay";
ti,pindir-d0-out-d1-in = <1>;
ti,spi-num-cs = <1>;
pinctrl-names = "default";
pinctrl-0 = <&mcspi1_pins_default>;
spidev@0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "siemens,spiMachV";
spi-max-frequency = <3000000>;
spi-cpol;
reg = <0>;
port {
cam: endpoint {
remote-endpoint = <&vin3aEndpoint>;
hsync-active = <1>;
vsync-active = <1>;
pclk-sample = <0>;
input-clock-freq = <32000000>;
pixel-clock-freq = <96000000>;
};
};

};

};

&vip2 {
status = "okay";
bus-width = <16>;
ports {
bus-width = <16>;
port@0 {
bus-width = <16>;
endpoint {
bus-width = <16>;
};
};
};
};


&vin3a {
status = "okay";
bus-width = <16>;
/delete-node/ endpoint@0;
vin3aEndpoint: endpoint {
bus-width = <16>;
slave-mode;
remote-endpoint = <&cam>;
};
};

Compiling and reverse compiling I get the following configuration for vip@0x48990000. Note the "bus-width = <0x10>;" on every layer.


........


vip@0x48990000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
bus-width = <0x10>;
compatible = "ti,vip2";

interrupts = <0x0 0x160 0x4 0x0 0x189 0x4>;
reg = <0x48990000 0x114 0x48995500 0xd8 0x48995700 0x18 0x48995800 0x80 0x48995a00 0xd8 0x48995c00 0x18 0x48995d00 0x80 0x4899d000 0x400>;
reg-names = "vip", "parser0", "csc0", "sc0", "parser1", "csc1", "sc1", "vpdma";
status = "okay";
syscon-pol = <0x9 0x534>;
ti,hwmods = "vip2";

ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
bus-width = <0x10>;

port@0 {
bus-width = <0x10>;
reg = <0x0>;
status = "okay";

endpoint {
bus-width = <0x10>;
phandle = <0xae>;
remote-endpoint = <0xd5>;
slave-mode;
};
};

port@1 {
reg = <0x1>;
};

port@2 {
reg = <0x2>;
};

port@3 {
reg = <0x3>;
};
};
};

------------------------------------------------

Then I checked the PIN multiplexing and I think that this should be OK.

Adress Value
0x4a003400 0x00050102
0x4a003404 0x00050102
0x4a003408 0x00050102
0x4a00340c 0x00050102
0x4a003410 0x00050102
0x4a003414 0x00050102
0x4a003418 0x00050102
0x4a00341c 0x00050102
0x4a003420 0x00050102
0x4a003424 0x00050102
0x4a003428 0x00050102
0x4a00342c 0x00050102
0x4a003430 0x00050102
0x4a003434 0x00050102
0x4a003438 0x00050102
0x4a00343c 0x00050102

------------------------------------

Here e2e.ti.com/.../812799 I read that linux should be able to capture 16bit RAW imaages
if the sensor driver registers MEDIA_BUS_FMT_SBGGR16_1X16 so I added the following configuration to my sensor driver.


static phyton_format phyton_cfmts[]={
{
.code = MEDIA_BUS_FMT_SBGGR16_1X16,
.colorspace = V4L2_COLORSPACE_SMPTE170M,
.fmt = 1,
.order = 1,
},
}

For testing I added also a framesize with half of the width and hight and configured a window on the image sensor so that I can test with my application without changing the frame buffer allocation.

In vip.c there was already an entry

{
/* V4L2 currently only defines one 16 bit variant */
.fourcc = V4L2_PIX_FMT_SBGGR16,//15
.code = MEDIA_BUS_FMT_SBGGR16_1X16,
.colorspace = V4L2_COLORSPACE_SMPTE170M,
.coplanar = 0,
.vpdma_fmt = { &vpdma_raw_fmts[VPDMA_DATA_FMT_RAW16],
},
},

so I configured the v4l from my user space application with the following commands


v4lImageObj.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
v4lImageObj.fmt.fmt.pix.width = sensorFormats[configIndex].width/2;
v4lImageObj.fmt.fmt.pix.height = sensorFormats[configIndex].height/2;
v4lImageObj.fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_SBGGR16;

xioctl(v4lImageObj.fd, VIDIOC_S_FMT, &(v4lImageObj.fmt));

In my understanding video 4 linux then checks if the sub-device can hanel the pixel format, and starts the subdevice with that.

From the kernel logs it seems that the format is selected:

38.434200] mvImgDev: ###### Framesize is 0 0 1296 1024
[ 38.434217] mvImgDev: Frame size match err: 2320, cand 2592,2048 size: 1296,1024
[ 38.434233] mvImgDev: Frame size match err: 2320, cand 2592,2048 size: 1296,1024
[ 38.434250] mvImgDev: Frame size match err: 0, cand 1296,1024 size: 1296,1024
[ 38.434266] mvImgDev: Frame size match err: 800, cand 1920,1200 size: 1296,1024
[ 38.434282] mvImgDev: Frame size matched with index: 2
[ 38.434298] mvImgDev: ###### Matched Framesize is 0 0 1296 1024
[ 38.434314] mvImgDev: ###### Colorspace 0x8
[ 38.434331] mvImgDev: ###### Code 0x301d
[ 38.434347] mvImgDev: ###### Field 0x1
[ 38.434363] mvImgDev: ##### Return Code 0
[ 38.434380] vin3a-0: s_fmt subdev fmt mbus_code: 301D size: 1296x1024
[ 38.434396] vin3a-0: s_fmt vpdma data type: 0x27
[ 38.944827] vin3a-0: get 30 buffer(s) of size 2654208 each.
[ 38.947093] vin3: vip_set_slice_path:
[ 38.947117] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 80008000
[ 38.947135] vin3: vip_set_slice_path:
[ 38.947160] vin3: vip_set_slice_path: DATA_PATH_SELECT(0000010C): 40008000
[ 38.947515] ##################### Streaming switched on
[ 38.952865] mvImgDev: __phyton_set_power: on: 1
[ 38.952885] mvImgDev: In function phyton_set_resolution_params 1296 1024
[ 38.952905] mvImgDev: In function phyton_set_resolution_params 29e3ebb9
[ 38.952922] mvImgDev: In function phyton_set_resolution_params 1296 1024
[ 38.959002] mvImgDev: format : 301d
[ 38.959021] mvImgDev: size : 1296 x 1024
[ 38.959441] mvImgDev: ##################### Streaming switched on
[ 38.959473] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:0
[ 38.959493] vin3a-0: start_dma: vb2 buf idx:0, dma_addr:0x00000000de100000
[ 38.960695] vin3a-0: vip_load_vpdma_list_fifo: start_dma vb2 buf idx:1
[ 38.960715] vin3a-0: start_dma: vb2 buf idx:1, dma_addr:0x00000000de700000


But the result is always that the bits from d0..d7 are sampled from the vip port and transferred to RAM.
I need d0..d15 being sampled and transferred to memory.

Does someone see what is wrong with my configuration?

Here software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html
is a FAQ "Can VIP be used as high speed interface to bring any data in?" and below is a note
"Note that VIP driver supports only 8 bit RAW mode. Enabling 16 bit RAW mode capture needs minor driver modifications."
Are these driver modifications the two configurations printed below or do I have to make additional modifications.

Thank you very much for your help.

Stephan

  • Hi Stephen,

    I will take a look at your post and get back this week.

    Regrads,

    Manisha

  • Hello Manisha,

    thank you very much for your effort. If you know about an example application for the am5728 evm (I also have the camera module) this could help me a lot also.

    Regards,

        Stephan

  • Hi Stephan,

    VIP driver scans the endpoint property  from the remote-endpoint.  So “bus-width = <16>;” would need to be specified on the sensor endpoint node, like this:

     

    &mcspi1 {

    status = "okay";

    ti,pindir-d0-out-d1-in = <1>;

    ti,spi-num-cs = <1>;

    pinctrl-names = "default";

    pinctrl-0 = <&mcspi1_pins_default>;

    spidev@0 {

    #address-cells = <1>;

    #size-cells = <0>;

    compatible = "siemens,spiMachV";

    spi-max-frequency = <3000000>;

    spi-cpol;

    reg = <0>;

    port {

    cam: endpoint {

    remote-endpoint = <&vin3aEndpoint>;

    hsync-active = <1>;

    vsync-active = <1>;

    pclk-sample = <0>;

    bus-width = <16>;

    input-clock-freq = <32000000>;

    pixel-clock-freq = <96000000>;

    };

    };

     

    };

    };

    I do not have any 16-bit capture example  as AM57x EVM only support 8-bits wide bus. Hopefully above setting should resolve the issue you are facing at your end, 

    Regards,
    Manisha