Difference between revisions of "CSI Manual on Pi 5"
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This tutorial is only for [[C790]] and [[C779]]. It should be noted that C790 supports audio and supports resolution up to 1080P@'''60HZ''', but C779 does not support audio and the resolution is only 1080P@'''50HZ''' | This tutorial is only for [[C790]] and [[C779]]. It should be noted that C790 supports audio and supports resolution up to 1080P@'''60HZ''', but C779 does not support audio and the resolution is only 1080P@'''50HZ''' | ||
+ | |||
1. Edit /boot/config.txt (sudo permission required). | 1. Edit /boot/config.txt (sudo permission required). | ||
Line 52: | Line 53: | ||
/dev/media3 | /dev/media3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | '''PS''': Please remember '''the media number''' in line 33. The following commands must use the same media number. | ||
3. Locate the node corresponding to tc358743 as v4l-subdev2, and the pad0 of rp1-cfe-csi2_ch0 as video0: | 3. Locate the node corresponding to tc358743 as v4l-subdev2, and the pad0 of rp1-cfe-csi2_ch0 as video0: | ||
+ | |||
+ | Note: The '''/dev/media0''' here comes from the media number obtained in the previous step. | ||
<syntaxhighlight lang="python" line highlight="63-65,85-87"> | <syntaxhighlight lang="python" line highlight="63-65,85-87"> | ||
blikvm@blikvm:~ $ media-ctl -d /dev/media0 -p | blikvm@blikvm:~ $ media-ctl -d /dev/media0 -p | ||
Line 203: | Line 207: | ||
6. Initialize media0. | 6. Initialize media0. | ||
media-ctl -d /dev/media0 -r | media-ctl -d /dev/media0 -r | ||
+ | Note: The '''/dev/media0''' here comes from the media number obtained in the '''step 2'''. | ||
Line 213: | Line 218: | ||
media-ctl -d /dev/media0 -V ''\''csi2'\'':4 [fmt:RGB888_1X24/1920x1080 field:none colorspace:srgb]' | media-ctl -d /dev/media0 -V ''\''csi2'\'':4 [fmt:RGB888_1X24/1920x1080 field:none colorspace:srgb]' | ||
</pre> | </pre> | ||
+ | Note: The '''/dev/media0''' here comes from the media number obtained in the '''step 2'''. | ||
+ | |||
9. Set the output format. | 9. Set the output format. |
Latest revision as of 15:04, 10 September 2024
This tutorial is only for C790 and C779. It should be noted that C790 supports audio and supports resolution up to 1080P@60HZ, but C779 does not support audio and the resolution is only 1080P@50HZ
1. Edit /boot/config.txt (sudo permission required).
- sudo nano /boot/config.txt
- Add the following content:
- dtoverlay=tc358743
- If your modules C790 support audio, add the following content to enable audio support. If you use C779, please ignore this step
- dtoverlay=tc358743-audio
- Then reboot the raspberry Pi.
2. Execute the following command to find the media node corresponding to the CSI as media0, under the rp1-cfe (platform: 1f00128000.csi) field:
- v4l2-ctl --list-devices
1 blikvm@blikvm:~ $ v4l2-ctl --list-devices
2 pispbe (platform:1000880000.pisp_be):
3 /dev/video20
4 /dev/video21
5 /dev/video22
6 /dev/video23
7 /dev/video24
8 /dev/video25
9 /dev/video26
10 /dev/video27
11 /dev/video28
12 /dev/video29
13 /dev/video30
14 /dev/video31
15 /dev/video32
16 /dev/video33
17 /dev/video34
18 /dev/video35
19 /dev/video36
20 /dev/video37
21 /dev/media1
22 /dev/media2
23
24 rp1-cfe (platform:1f00128000.csi):
25 /dev/video0
26 /dev/video1
27 /dev/video2
28 /dev/video3
29 /dev/video4
30 /dev/video5
31 /dev/video6
32 /dev/video7
33 /dev/media0
34
35 rpivid (platform:rpivid):
36 /dev/video19
37 /dev/media3
PS: Please remember the media number in line 33. The following commands must use the same media number.
3. Locate the node corresponding to tc358743 as v4l-subdev2, and the pad0 of rp1-cfe-csi2_ch0 as video0:
Note: The /dev/media0 here comes from the media number obtained in the previous step.
1 blikvm@blikvm:~ $ media-ctl -d /dev/media0 -p
2 Media controller API version 6.1.63
3
4 Media device information
5 ------------------------
6 driver rp1-cfe
7 model rp1-cfe
8 serial
9 bus info platform:1f00128000.csi
10 hw revision 0x114666
11 driver version 6.1.63
12
13 Device topology
14 - entity 1: csi2 (8 pads, 8 links)
15 type V4L2 subdev subtype Unknown flags 0
16 device node name /dev/v4l-subdev0
17 pad0: Sink
18 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
19 <- "tc358743 4-000f":0 [ENABLED,IMMUTABLE]
20 pad1: Sink
21 [fmt:unknown/8192x1 field:none]
22 pad2: Sink
23 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
24 pad3: Sink
25 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
26 pad4: Source
27 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
28 -> "rp1-cfe-csi2_ch0":0 []
29 -> "pisp-fe":0 []
30 pad5: Source
31 [fmt:unknown/8192x1 field:none]
32 -> "rp1-cfe-embedded":0 []
33 pad6: Source
34 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
35 -> "rp1-cfe-csi2_ch2":0 []
36 -> "pisp-fe":0 []
37 pad7: Source
38 [fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
39 -> "rp1-cfe-csi2_ch3":0 []
40 -> "pisp-fe":0 []
41
42 - entity 10: pisp-fe (5 pads, 7 links)
43 type V4L2 subdev subtype Unknown flags 0
44 device node name /dev/v4l-subdev1
45 pad0: Sink
46 [fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
47 <- "csi2":4 []
48 <- "csi2":6 []
49 <- "csi2":7 []
50 pad1: Sink
51 [fmt:FIXED/8192x1 field:none]
52 <- "rp1-cfe-fe_config":0 []
53 pad2: Source
54 [fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
55 -> "rp1-cfe-fe_image0":0 []
56 pad3: Source
57 [fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
58 -> "rp1-cfe-fe_image1":0 []
59 pad4: Source
60 [fmt:FIXED/8192x1 field:none]
61 -> "rp1-cfe-fe_stats":0 []
62
63 - entity 16: tc358743 4-000f (1 pad, 1 link)
64 type V4L2 subdev subtype Unknown flags 0
65 device node name /dev/v4l-subdev2
66 pad0: Source
67 [fmt:RGB888_1X24/640x480 field:none colorspace:srgb]
68 [dv.caps:BT.656/1120 min:640x350@13000000 max:1920x1200@165000000 stds:CEA-861,DMT,CVT,GTF caps:progressive,reduced-blanking,custom]
69 [dv.detect:BT.656/1120 1920x1080p24 (2750x1125) stds: flags:]
70 [dv.current:BT.656/1120 640x480p59 (800x525) stds:CEA-861,DMT flags:has-cea861-vic]
71 -> "csi2":0 [ENABLED,IMMUTABLE]
72
73 - entity 18: rp1-cfe-csi2_ch0 (1 pad, 1 link)
74 type Node subtype V4L flags 0
75 device node name /dev/video0
76 pad0: Sink
77 <- "csi2":4 []
78
79 - entity 22: rp1-cfe-embedded (1 pad, 1 link)
80 type Node subtype V4L flags 0
81 device node name /dev/video1
82 pad0: Sink
83 <- "csi2":5 []
84
85 - entity 26: rp1-cfe-csi2_ch2 (1 pad, 1 link)
86 type Node subtype V4L flags 0
87 device node name /dev/video2
88 pad0: Sink
89 <- "csi2":6 []
90
91 - entity 30: rp1-cfe-csi2_ch3 (1 pad, 1 link)
92 type Node subtype V4L flags 0
93 device node name /dev/video3
94 pad0: Sink
95 <- "csi2":7 []
96
97 - entity 34: rp1-cfe-fe_image0 (1 pad, 1 link)
98 type Node subtype V4L flags 1
99 device node name /dev/video4
100 pad0: Sink
101 <- "pisp-fe":2 []
102
103 - entity 38: rp1-cfe-fe_image1 (1 pad, 1 link)
104 type Node subtype V4L flags 0
105 device node name /dev/video5
106 pad0: Sink
107 <- "pisp-fe":3 []
108
109 - entity 42: rp1-cfe-fe_stats (1 pad, 1 link)
110 type Node subtype V4L flags 0
111 device node name /dev/video6
112 pad0: Sink
113 <- "pisp-fe":4 []
114
115 - entity 46: rp1-cfe-fe_config (1 pad, 1 link)
116 type Node subtype V4L flags 0
117 device node name /dev/video7
118 pad0: Source
119 -> "pisp-fe":1 []
4. To query the current input source information, if the resolution displays as 0, it indicates that no input source signal has been detected. In this case, you should check the hardware connections and follow the steps mentioned above to troubleshoot.
- v4l2-ctl -d /dev/v4l-subdev2 --query-dv-timings
1 blikvm@blikvm:~ $ v4l2-ctl -d /dev/v4l-subdev2 --query-dv-timings
2 Active width: 1920
3 Active height: 1080
4 Total width: 2750
5 Total height: 1125
6 Frame format: progressive
7 Polarities: -vsync -hsync
8 Pixelclock: 74250000 Hz (24.00 frames per second)
9 Horizontal frontporch: 0
10 Horizontal sync: 830
11 Horizontal backporch: 0
12 Vertical frontporch: 0
13 Vertical sync: 45
14 Vertical backporch: 0
15 Standards:
16 Flags:
5. Confirm the current input source information.
v4l2-ctl -d /dev/v4l-subdev2 --set-dv-bt-timings query
6. Initialize media0.
media-ctl -d /dev/media0 -r
Note: The /dev/media0 here comes from the media number obtained in the step 2.
7. Connect CSI2's pad4 to rp1-cfe-csi2_ch0's pad0.
media-ctl -d /dev/media0 -l ''\''csi2'\'':4 -> '\''rp1-cfe-csi2_ch0'\'':0 [1]'
8. Configure the media node.
media-ctl -d /dev/media0 -V ''\''csi2'\'':0 [fmt:RGB888_1X24/1920x1080 field:none colorspace:srgb]' media-ctl -d /dev/media0 -V ''\''csi2'\'':4 [fmt:RGB888_1X24/1920x1080 field:none colorspace:srgb]'
Note: The /dev/media0 here comes from the media number obtained in the step 2.
9. Set the output format.
v4l2-ctl -v width=1920,height=1080,pixelformat=RGB3
10. Capture two frames for testing to verify if tc358743 is functioning properly. Other methods, such as using GStreamer, are not currently available.
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='RGB3' --stream-mmap=4 --stream-skip=3 --stream-count=2 --stream-to=hdmiin.yuv --stream-poll
11. If you have installed a desktop version of Raspberry Pi, you can use ffplay to directly play YUV files.
ffplay -f rawvideo -video_size 1920x1080 -pixel_format bgr24 hdmiin.yuv
On a Windows computer, you can use software like 7yuv to view .yuv files. For the tutorial with an input format of 19201080, you should select BGR888 in the top right corner of 7yuv and set the resolution to 19201080 to view the two frames you just captured.
Enable comment auto-refresher
Anonymous user #1
Permalink |