Open main menu

Changes

CSI Manual on Pi 5

6,016 bytes removed, Monday at 11:07
Replaced content with "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 audi..."
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).:<pre>sudo nano /boot/firmware/config.txt</pre>:Add the following content:: <pre>dtoverlay=tc358743</pre> :If your modules [[C790]] support audio, add the following content to enable audio support. If you use [[C779]], please ignore this step: <pre>dtoverlay=tc358743-audio</pre> : If (and only if) you have a device such as the C790 that supports the 22pin connector with all 4 lanes wired out, and are using a Compute Module with the CAM1 connector that also has all 4 lanes wired up, you can use:: <pre>dtoverlay=tc358743,4lane=1</pre> : Then '''reboot''' the raspberry Pi board, '''this is very important!DON'T miss this step!''': <pre>sudo reboot</pre> :After adding the driver configuration, restart the Raspberry Pi for it to take effect. If the configuration is correct, execute '''ls /dev/video*''' in the terminal, and you should see video devices listed::<pre>ls /dev/video1</pre>:<pre>/dev/video1</pre> 2. Execute the following command to find the '''media node''' corresponding to the CSI as '''media0''', under the '''rp1-cfe (platform: 1f00128000.csi)''' field:<syntaxhighlight lang="python" line highlight="24,33">blikvm@blikvm:~ $ v4l2-ctl --list-devicespispbe (platform:1000880000.pisp_be): /dev/video20 /dev/video21 /dev/video22 /dev/video23 /dev/video24 /dev/video25 /dev/video26 /dev/video27 /dev/video28 /dev/video29 /dev/video30 /dev/video31 /dev/video32 /dev/video33 /dev/video34 /dev/video35 /dev/video36 /dev/video37 /dev/media1 /dev/media2 rp1-cfe (platform:1f00128000.csi): /dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/video4 /dev/video5 /dev/video6 /dev/video7 /dev/media0 rpivid (platform:rpivid): /dev/video19 /dev/media3</syntaxhighlight>'''PS''': Please remember '''the media number''' in line 33. The following commands must use the same media number. 2.1 Create an EDID file with the following command. sudo nano edid60.txt<pre>00 ff ff ff ff ff ff 00 52 62 00 37 00 00 00 0001 1b 01 03 80 46 28 78 0a cf 74 a3 57 4c b0 2309 48 4c 21 08 00 b3 00 95 00 a9 40 90 40 81 0081 80 81 40 01 01 02 3a 80 18 71 38 2d 40 58 2c45 00 00 d0 52 00 00 1e 02 3a 80 d0 72 38 2d 4010 2c 45 80 00 d0 52 00 00 1e 00 00 00 fc 00 3332 46 48 44 5f 4c 43 44 5f 54 56 0a 00 00 00 fd00 30 3e 0f 46 11 00 0a 20 20 20 20 20 20 01 3802 03 30 f1 52 10 9f 04 13 05 14 03 02 11 12 2021 22 15 16 01 06 07 2c 09 07 07 15 07 50 57 0600 3f 06 c0 83 01 00 00 67 03 0c 00 10 00 b0 2d01 1d 80 3e 73 38 2d 40 7e 2c 45 80 00 d0 52 0000 1e 01 1d 80 d0 72 1c 2d 20 10 2c 25 80 00 d052 00 00 9e 01 1d 00 bc 52 d0 1e 20 b8 28 55 4000 d0 52 00 00 1e 01 1d 80 18 71 1c 16 20 58 2c25 00 00 d0 52 00 00 9e 00 00 00 00 00 00 00 8f</pre>Copy the above content and paste them into the file then save it. 2.2 Loading the EDID data with the following command: For the Debian version 12 (Bookworm),  v4l2-ctl -d /dev/v4l-subdev2 --set-edid=file=/home/pi/edid60.txt --fix-edid-checksumsFor the Debian version 13 (trixie), v4l2-ctl -d /dev/v4l-subdev2 --set-edid=file=/home/pi/edid60.txtPS:Pay attention refer to the directory of your edid file 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. media-ctl -d /dev/media0 -p 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<syntaxhighlight lang="python" line highlight="2-3,8">blikvm@blikvm:~ $ v4l2-ctl -d /dev/v4l-subdev2 --query-dv-timings Active width: 1920 Active height: 1080 Total width: 2750 Total height: 1125 Frame format: progressive Polarities: -vsync -hsync Pixelclock: 74250000 Hz (24.00 frames per second) Horizontal frontporch: 0 Horizontal sync: 830 Horizontal backporch: 0 Vertical frontporch: 0 Vertical sync: 45 Vertical backporch: 0 Standards: Flags:</syntaxhighlight>5. Confirm the current input source information. v4l2-ctl -d /dev/v4l-subdev2 --set-dv-bt-timings query[[File:X1300v1.0-setting5.pngX1300 Software]]  6. Initialize media0. media-ctl -d /dev/media0 -rNote: 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.<pre>media-ctl -d /dev/media0 -l ''\''csi2'\'':4 -> '\''rp1-cfe-csi2_ch0'\'':0 [1]'</pre> 8. Configure the media node.<pre>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]'</pre>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. 
Return to [[C790]] / [[C779]]