AM625: blurred image with imx219

Part Number: AM625
Other Parts Discussed in Thread: SK-AM62B-P1,

Tool/software:

I try taking an image with our custom board based on the SK-AM62X using an imx219 Raspberry Cam V2. I based my dts-nodes on k3-am62x-sk-csi2-imx219.dtso (with the exception of the reset-gpio, but using the regulator works fine for toggeling the reset pin), but the image I take is quite distorted. Do I need to change the pixelrate or something else? And if so, where do I do so? I attached the image taken, sheared, and the "corrected" one.

DTS:

clk_imx219_fixed: imx219-xclk {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
};
reg_cam: regulator-cam {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_reg_cam>;
compatible = "regulator-fixed";
regulator-name = "reg_cam";
gpio = <&main_gpio0 34 GPIO_ACTIVE_HIGH>;
enable-active-high;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
&main_i2c2 {
imx219: sensor@10 {
compatible = "sony,imx219";
reg = <0x10>;

clocks = <&clk_imx219_fixed>;
clock-names = "xclk";

VDIG-supply = <&reg_cam>;

port {
csi2_cam0: endpoint {
remote-endpoint = <&csi2rx0_in_sensor>;
link-frequencies = /bits/ 64 <456000000>;
clock-noncontinuous;
clock-lanes = <0>;
data-lanes = <1 2>;
};
};
};
};
pinctrl_reg_cam: reg-cam-pins {
pinctrl-single,pins = <
AM62X_IOPAD(0x008c, PIN_OUTPUT_PULLUP, 7) /* (L25) GPMC0_WEn.GPIO0_34 */
>;
};
commands used:
media-ctl -d /dev/media0 --reset
media-ctl --set-v4l2 "'30102000.ticsi2rx':0 [fmt:SRGGB8_1X8/640x480 field:none]"
media-ctl --set-v4l2 "'cdns_csi2rx.30101000.csi-bridge':0 [fmt:SRGGB8_1X8/640x480 field:none]"
media-ctl --set-v4l2 "'imx219 2-0010':0 [fmt:SRGGB8_1X8/640x480 field:none]"
v4l2-ctl -d /dev/video0 --set-fmt-video=width=640,height=480,pixelformat=RGGB
v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=csi.raw

  • Hello Dominik,

    Sorry, but I don't fully understand what you meant by "image taken, sheared, and the "corrected" one". Can you try to capture multiple images using yavta and see if all images have the same issue? The first captured image may have invalid data.

    yavta -s 640x480 -f SRGGB /dev/video0 -c5 -Fframe-#.bin

    Can you share the full logs of "v4l2-ctl --list-devices" and "media-ctl -p"?

    Thanks,

    Jianzhong

  • Hi Jianzhong,

    the image taken by the camera is the first image I attached, the third one represents what the image should, more or less, look like (without the left and right parts, image was processed with GIMP afterwards)

    yavta -s 640x480 -f SRGGB /dev/video0 -c5 -Fframe-#.bin

    With SRGGB8 it works, but the  images are still distorted:

    logs:

    root@am62xx-eva-mi:~# v4l2-ctl --list-devices
    j721e-csi2rx (platform:30102000.ticsi2rx):
    /dev/video0
    /dev/video1
    /dev/video2
    /dev/video3
    /dev/media0

    root@am62xx-eva-mi:~# media-ctl -p
    Media controller API version 6.1.83

    Media device information
    ------------------------
    driver j721e-csi2rx
    model TI-CSI2RX
    serial
    bus info platform:30102000.ticsi2rx
    hw revision 0x1
    driver version 6.1.83

    Device topology
    - entity 1: 30102000.ticsi2rx (5 pads, 5 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev0
    pad0: Sink
    [fmt:SRGGB8_1X8/640x480 field:none]
    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
    pad1: Source
    [fmt:SRGGB8_1X8/640x480 field:none]
    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
    pad2: Source
    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
    pad3: Source
    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
    pad4: Source
    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]

    - entity 7: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links)
    type V4L2 subdev subtype Unknown flags 0
    device node name /dev/v4l-subdev1
    pad0: Sink
    [fmt:SRGGB8_1X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
    <- "imx219 2-0010":0 [ENABLED,IMMUTABLE]
    pad1: Source
    [fmt:SRGGB8_1X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    pad2: Source
    pad3: Source
    pad4: Source

    - entity 13: imx219 2-0010 (1 pad, 1 link)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev2
    pad0: Source
    [fmt:SRGGB8_1X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range
    crop.bounds:(8,8)/3280x2464
    crop:(1008,760)/1280x960]
    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]

    - entity 19: 30102000.ticsi2rx context 0 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video0
    pad0: Sink
    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]

    - entity 25: 30102000.ticsi2rx context 1 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video1
    pad0: Sink
    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]

    - entity 31: 30102000.ticsi2rx context 2 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video2
    pad0: Sink
    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]

    - entity 37: 30102000.ticsi2rx context 3 (1 pad, 1 link)
    type Node subtype V4L flags 0
    device node name /dev/video3
    pad0: Sink
    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]

  • The imx219 is a raw sensor. How did you view the captured image? What does the real scene look like?

  • I used digikam, which directly converted it to make it visible. This is just used to confirm the settings, and it worked fine when using the same baseboard with a different SoM and the same imx219. The real scene is visible in the third picture from my first post. The cam used is a NoIR, so the colors are slightly different.

    This is how the scene looks like:

  • Ok. Thanks for the additional information. I guess the image taken by the IMX219 should look like this (from your 3rd image in the original post):

    The 1st image in your original post seemed getting the pixels but the pixels were not arranged properly in rows and columns. Not sure what was the problem.

    Did you see any error message when capturing the images?

    Regards,

    Jianzhong

  • Exactly.

    No, there were no error messages shown. The fact that the pixels are right but wrongly arranged led to my suspicion that something with the timing is wrong, but I found no part where I could adjust it.

  • Do you have this AM62A board: https://www.ti.com/tool/SK-AM62A-LP? I'm wondering if the camera would work fine with this board.

  • Can you try some test patterns from the sensor?

    v4l2-ctl -d  /dev/v4l-subdev2 --set-ctrl test_pattern=<0, 1, 2, etc.>

  • We only have the SK-AM62B-P1. I have read that the AM625 has no ISP, so there is no streaming possible, but simple picture capture should work.

    Here are the test pattern from 0 - 4:

  • Were these images captured using SK-AM62B-P1 or your custom board?

    What exact camera are you using?

  • These picutres were taken by an RPi Cam NoIR v2, featuring an imx219, connected to our custom board. I can try taking pictures with the SK-AM62B-P1, might take a short while as I need another connector cable

  • Ok. Please update me when you have the captures.

  • Hi Jianzhong,

    I managed to take some pictures with the AM62B-P1 and the RPi Cam, and they look fine. I will review our hardware and the Device Tree configuration to check for any differences. I’ll keep you posted.

  • Thanks for the update.

  • Comparing the devicetree showed nothing, and the only difference in hardware are 10Ohm resistors on the CSI data and clock lanes. I would suspect the signal length, but the same baseboard works fine with other SoMs.

    I also tried a second baseboard to rule out the possibility of a faulty CPU, but still the same result. The camera itself works fine with the AM62B-P1

  • Looping in our HW team to help.

  • Hello Dominik,

    I looked at the thread and cant see any hardware information.

    Did you share any hardware information for me to review.

    Regards,

    Sreenivasa