Hi,
Following up from previous posts, we’ve managed to customize the ov5693 driver to operate a MIPI camera without i2c.
A signal check after the cable shows electrical signals are being transmitted, so when powered up, mipi data is already transmitted without any action from the jetson.
Please find here the clock and data outputs (respectively) as can be analyzed externally:
The fpga core is configured for 640x512 at raw12 format, with the following wiring scheme:
On the jetson side, here’s an excerpt from the relevant dtsi section (the i2c bus was set to the 40-pin header for testing purposes):
{
host1x {
vi@15c10000 {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_vi_in0: endpoint {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&e3326_csi_out0>;
};
};
};
};
nvcsi@15a00000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
channel@0 {
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_csi_in0: endpoint@0 {
port-index = <2>;
bus-width = <4>;
remote-endpoint = <&e3326_ov5693_out0>;
};
};
port@1 {
reg = <1>;
e3326_csi_out0: endpoint@1 {
remote-endpoint = <&e3326_vi_in0>;
};
};
};
};
};
};
i2c@31e0000 {
ov5693_c@20 {
compatible = "nvidia,ov5693";
/* I2C device address */
reg = <0x20>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "15.0";
physical_h = "12.5";
sensor_model ="mytester";
post_crop_frame_drop = "0";
use_decibel_gain = "false";
delayed_gain = "false";
use_sensor_mode_id = "true";
limit_analog_gain = "true";
mode0 {/*mode C4I_MODE_640X512_CROP_30FPS*/
mclk_khz = "324000";
num_lanes = "4";
tegra_sinterface = "serial_a";
phy_mode = "DPHY";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "18";
active_w = "640";
active_h = "512";
dynamic_pixel_bit_depth = "12";
mode_type = "bayer";
pixel_phase = "rggb";
csi_pixel_bit_depth = "12";
readout_orientation = "0";
line_length = "640";
inherent_gain = "1";
pix_clk_hz = "54000000";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
e3326_ov5693_out0: endpoint {
port-index = <0>;
bus-width = <4>;
remote-endpoint = <&e3326_csi_in0>;
};
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
num_csi_lanes = <4>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <12>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <160000>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;
modules {
module0 {
badge = "e3326_front_P5V27C";
position = "rear";
orientation = "1";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "ov5693 8-0020";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@31e0000/ov5693_c@20";
};
};
};
};
};
After enabling debug and tracing via:
# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
# echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
# echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
# cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
# cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/isp/rate
# cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate
# echo 1 > /sys/kernel/debug/tracing/tracing_on
# echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
# echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
# echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
# echo 2 > /sys/kernel/debug/camrtc/log-level
# echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
# echo > /sys/kernel/debug/tracing/trace
Running:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=640,height=512,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=2 --stream-to=test.raw --verbose
Yields:
VIDIOC_QUERYCAP: ok
VIDIOC_S_EXT_CTRLS: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
Width/Height : 640/512
Pixel Format : 'RG12'
Field : None
Bytes per Line : 1280
Size Image : 655360
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
Index : 0
Type : Video Capture
Flags : mapped, error
Field : None
Sequence : 0
Length : 655360
Bytesused: 655360
Timestamp: 0.000000s (Monotonic, End-of-Frame)
And the tracer (/sys/kernel/debug/tracing/trace) output is:
# tracer: nop
#
# entries-in-buffer/entries-written: 59/59 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
v4l2-ctl-9906 [002] .... 987.937282: tegra_channel_open: vi-output, ov5693 8-0020
v4l2-ctl-9906 [000] .... 987.939882: tegra_channel_set_power: ov5693 8-0020 : 0x1
v4l2-ctl-9906 [000] .... 987.939894: camera_common_s_power: status : 0x1
v4l2-ctl-9906 [000] .... 987.940841: tegra_channel_set_power: 15a00000.nvcsi--1 : 0x1
v4l2-ctl-9906 [000] .... 987.940844: csi_s_power: enable : 0x1
v4l2-ctl-9906 [000] .... 987.945330: tegra_channel_capture_setup: vnc_id 0 W 640 H 512 fmt c4
v4l2-ctl-9906 [006] .... 987.950946: tegra_channel_set_stream: enable : 0x1
v4l2-ctl-9906 [000] .... 987.952418: tegra_channel_set_stream: 15a00000.nvcsi--1 : 0x1
v4l2-ctl-9906 [000] .... 987.952422: csi_s_stream: enable : 0x1
v4l2-ctl-9906 [000] .... 987.952429: tegra_channel_set_stream: ov5693 8-0020 : 0x1
kworker/0:0-9674 [000] .... 987.987355: rtos_queue_peek_from_isr_failed: tstamp:31329642480 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 987.987359: rtcpu_start: tstamp:31329643757
kworker/0:0-9674 [000] .... 987.987361: rtos_queue_send_from_isr_failed: tstamp:31329690346 queue:0x0bcb2e38
kworker/0:0-9674 [000] .... 987.987362: rtos_queue_send_from_isr_failed: tstamp:31329690483 queue:0x0bcb76a0
kworker/0:0-9674 [000] .... 987.987363: rtos_queue_send_from_isr_failed: tstamp:31329690621 queue:0x0bcb9220
kworker/0:0-9674 [000] .... 987.987364: rtos_queue_send_from_isr_failed: tstamp:31329690754 queue:0x0bcb9fe0
kworker/0:0-9674 [000] .... 987.987366: rtos_queue_send_from_isr_failed: tstamp:31329690888 queue:0x0bcbada0
kworker/0:0-9674 [000] .... 987.987367: rtcpu_string: tstamp:31329691291 id:0x04010000 str:"Configuring VI GoS.
"
kworker/0:0-9674 [000] .... 987.987394: rtcpu_string: tstamp:31329691471 id:0x04010000 str:"VM GOS[#0] addr=0xc2100000
"
kworker/0:0-9674 [000] .... 987.987402: rtcpu_string: tstamp:31329691712 id:0x04010000 str:"VM GOS[#1] addr=0xc2101000
"
kworker/0:0-9674 [000] .... 987.987410: rtcpu_string: tstamp:31329691943 id:0x04010000 str:"VM GOS[#2] addr=0xc2102000
"
kworker/0:0-9674 [000] .... 987.987416: rtcpu_string: tstamp:31329692161 id:0x04010000 str:"VM GOS[#3] addr=0xc2103000
"
kworker/0:0-9674 [000] .... 987.987422: rtcpu_string: tstamp:31329692437 id:0x04010000 str:"VM GOS[#4] addr=0xc2104000
"
kworker/0:0-9674 [000] .... 987.987428: rtcpu_string: tstamp:31329692660 id:0x04010000 str:"VM GOS[#5] addr=0xc2105000
"
kworker/0:0-9674 [000] .... 987.987434: rtcpu_string: tstamp:31329700150 id:0x04010000 str:"vi5_hwinit: firmware CL2018101701 protocol vers"
kworker/0:0-9674 [000] .... 987.987435: rtcpu_string: tstamp:31329700255 id:0x04010000 str:"on 2.2
"
kworker/0:0-9674 [000] .... 987.987442: rtos_queue_send_from_isr_failed: tstamp:31329712426 queue:0x0bcb2e38
kworker/0:0-9674 [000] .... 987.987442: rtos_queue_send_from_isr_failed: tstamp:31329712580 queue:0x0bcb76a0
kworker/0:0-9674 [000] .... 987.987443: rtos_queue_send_from_isr_failed: tstamp:31329712724 queue:0x0bcb9220
kworker/0:0-9674 [000] .... 987.987444: rtos_queue_send_from_isr_failed: tstamp:31329712856 queue:0x0bcb9fe0
kworker/0:0-9674 [000] .... 987.987444: rtos_queue_send_from_isr_failed: tstamp:31329712988 queue:0x0bcbada0
kworker/0:0-9674 [000] .... 987.987445: rtcpu_string: tstamp:31329713830 id:0x04010000 str:"VI GOS[#0] set to VM GOS[4] base 0xc2104000
"
kworker/0:0-9674 [000] .... 987.987451: rtos_queue_send_from_isr_failed: tstamp:31329760710 queue:0x0bcb2e38
kworker/0:0-9674 [000] .... 987.987452: rtos_queue_send_from_isr_failed: tstamp:31329760846 queue:0x0bcb76a0
kworker/0:0-9674 [000] .... 987.987452: rtos_queue_send_from_isr_failed: tstamp:31329760986 queue:0x0bcb9220
kworker/0:0-9674 [000] .... 987.987453: rtos_queue_send_from_isr_failed: tstamp:31329761121 queue:0x0bcb9fe0
kworker/0:0-9674 [000] .... 987.987453: rtos_queue_send_from_isr_failed: tstamp:31329761253 queue:0x0bcbada0
kworker/0:0-9674 [000] .... 987.987455: rtcpu_nvcsi_intr: tstamp:31329763717 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x00000089
kworker/0:0-9674 [000] .... 987.987455: rtcpu_nvcsi_intr: tstamp:31329763717 class:GLOBAL type:PHY_INTR0 phy:1 cil:1 st:0 vc:0 status:0x00000088
kworker/0:0-9674 [000] .... 987.987457: rtcpu_vinotify_event: tstamp:31330012878 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:31888262304 data:0x10000000
kworker/0:0-9674 [000] .... 987.987458: rtcpu_vinotify_event: tstamp:31330013008 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:31888266112 data:0x31000001
kworker/0:0-9674 [000] .... 987.987458: rtcpu_vinotify_event: tstamp:31330013150 tag:RESERVED_19 channel:0x23 frame:0 vi_tstamp:31888267104 data:0x07020001
kworker/0:0-9674 [000] .... 987.987459: rtcpu_vinotify_event: tstamp:31330013274 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:31888302976 data:0x10000000
kworker/0:0-9674 [000] .... 987.987460: rtcpu_vinotify_event: tstamp:31330013415 tag:RESERVED_18 channel:0x23 frame:0 vi_tstamp:31888306816 data:0x31000002
kworker/0:0-9674 [000] .... 988.155385: rtos_queue_peek_from_isr_failed: tstamp:31334642837 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 988.323343: rtos_queue_peek_from_isr_failed: tstamp:31339642841 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 988.435352: rtos_queue_peek_from_isr_failed: tstamp:31344642839 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 988.603346: rtos_queue_peek_from_isr_failed: tstamp:31349642841 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 988.771353: rtos_queue_peek_from_isr_failed: tstamp:31354642838 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 988.939361: rtos_queue_peek_from_isr_failed: tstamp:31359642839 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.107350: rtos_queue_peek_from_isr_failed: tstamp:31364642841 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.275342: rtos_queue_peek_from_isr_failed: tstamp:31369642841 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.443358: rtos_queue_peek_from_isr_failed: tstamp:31374642839 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.555346: rtos_queue_peek_from_isr_failed: tstamp:31379642839 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.723353: rtos_queue_peek_from_isr_failed: tstamp:31384642835 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 989.891344: rtos_queue_peek_from_isr_failed: tstamp:31389642841 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 990.059343: rtos_queue_peek_from_isr_failed: tstamp:31394642842 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 990.227349: rtos_queue_peek_from_isr_failed: tstamp:31399642839 queue:0x0bcbbbb8
kworker/0:0-9674 [000] .... 990.395340: rtos_queue_peek_from_isr_failed: tstamp:31404642838 queue:0x0bcbbbb8
Any ideas on what might be the cause? (I know the reported format doesn’t match the desired one, but suppose it doesn’t explain lack of signals)
Several issues that come to mind and worth questioning:
-
Is the wiring enough and correct?
-
Does the dtsi definition suffices?
-
The original ov5693 defines avdd and iovdd in the dtsi for controlling the power mode and activating regulators, while in our case they’re missing and the driver code was modified to bypass them (so no regulators are being changed, nor any gpio in addition).
Should something be done on the jetson side to activate the mipi bus for receiving signals?
Many thanks,
Moti.