Open main menu

Changes

C779-Software

7,362 bytes added, 12 April
no edit summary
TC358743 HDMI to CSI-2 install instructions.
1The Raspberry Pi Foundation has updated several versions recently; The use guide of C779/C790/X630 depends on the official Raspberry Pi OS version you are using. Different versions have different usage methods. If you have some questions, please contact us and attach the osversion you are using.(<span style="color:red;">Email: support@geekworm.com</span>) You can refer to [https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=281972 Raspberry pi official forum post] To use the kernel drivers, please update your system. There are a few things that have changed with the 5.4 kernel, so these instructions are for 5.4 or later. If "uname -a" reports anything less, then fix this before proceeding.<pre>pi@raspberrypi:~ $ uname -aLinux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux</pre>
1. Update & upgrade the raspberry pi system (It will take a long time depend on the different country)
2. Enable camera module (the camera is enabled by default in Raspberry pi Bullseys OS)
sudo raspi-config
 [[File:Raspi-config-1.jpg|800px]] sudo reboot
Navigate to ''''Interfacing Options'''' and hit Enter. Now select the ''''Camera'''' option, and hit the Enter key to enable it. Select “Finish” and select to '''reboot''' your Raspberry Pi.
[[File:Raspi-config-2.jpg|800px]NOTE]reboot is important!!
3. Edit /boot/config.txt (that will need sudo) sudo rebootnano /boot/config.txt
2. Edit /boot/config.txt to add Add the line (that will need sudo, and use your preferred editor):
dtoverlay=tc358743
to the end of the file.
Add the line if your shield support audio like C790 dtoverlay=tc358743-audio please append theIf (and only if) you have a device such as the Auvidea B102 that supports the 22pin connector with all 4 lanes wired out(such as [[X1300]]), and are using a Compute Module with the CAM1 connector that also has all 4 lanes wired up, you can use
dtoverlay=tc358743,4lane=1
34. Check the amount of memory assigned to the CMA heap with "dmesg | grep cma". The first line should be along the lines of
pi@raspberrypi:~ $ dmesg | grep cma
[ 0.000000] cma: Reserved 256 MiB at 0x000000001ec00000
to the start of the line. Do NOT add any carriage returns.
45. Reboot. If all is well you should get a /dev/video0 device, and "v4l2-ctl --list-devices" will tell you that it is provided by Unicam.After connecting all the cables, power on the Raspberry Pi, the C779 /C790 indicator light is normally green, and after opening the Raspberry Pi terminal, enter the following command: ls /dev/video0[[File:Ls-dev.png|none]] v4l2-ctl --list-devices which will log something along the lines of
<pre>
pi@raspberrypi:~ $ ls /dev/video0
/dev/video0
pi@raspberrypi:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
/dev/video10
/dev/media2
</pre>
 
6. This driver puts all the control in the hands of the user, or the user's application. By default there is no EDID loaded into the chip to allow it to tell the HDMI source what resolutions are supported. There are EDID editors around.
If you create a file edid.txt, then you can push this to the device using
 
The comment of edid.txt file:
<pre>
00ffffffffffff005262888800888888
1c150103800000780aEE91A3544C9926
0F505400000001010101010101010101
010101010101011d007251d01e206e28
5500c48e2100001e8c0ad08a20e02d10
103e9600138e2100001e000000fc0054
6f73686962612d4832430a20000000FD
003b3d0f2e0f1e0a2020202020200100
020321434e041303021211012021a23c
3d3e1f2309070766030c00300080E300
7F8c0ad08a20e02d10103e9600c48e21
0000188c0ad08a20e02d10103e960013
8e210000188c0aa01451f01600267c43
00138e21000098000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
</pre>
<pre>
cd ~
sudo nano edid.txt
#copy the above commend in edid.txt, save&exit;
</pre>
<pre>
pi@raspberrypi:~ $ v4l2-ctl --set-edid=file=edid.txt --fix-edid-checksums
 
CTA-861 Header
IT Formats Underscanned: yes
Audio: yes
YCbCr 4:4:4: no
YCbCr 4:2:2: no
 
HDMI Vendor-Specific Data Block
Physical Address: 3.0.0.0
YCbCr 4:4:4 Deep Color: no
30-bit: no
36-bit: no
48-bit: no
 
CTA-861 Video Capability Descriptor
RGB Quantization Range: yes
YCC Quantization Range: no
PT: Supports both over- and underscan
IT: Supports both over- and underscan
CE: Supports both over- and underscan
</pre>
 
7. The driver does NOT automatically switch to the resolution detected. Use the command:
<pre>
pi@raspberrypi:~ $ v4l2-ctl --query-dv-timings
Active width: 1280
Active height: 720
Total width: 1650
Total height: 750
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 74250000 Hz (60.00 frames per second)
Horizontal frontporch: 0
Horizontal sync: 370
Horizontal backporch: 0
Vertical frontporch: 0
Vertical sync: 30
Vertical backporch: 0
Standards:
Flags:
</pre>
You MUST set the timings via "v4l2-ctl --set-dv-bt-timings". You can pass in an index to the detected mode, or use:
v4l2-ctl --set-dv-bt-timings query
to select the currently detected timings.
v4l2-ctl -V
should now reflect the resolution detected.
 
8. The chip supports two formats - RGB3(the default) and UYVY. RGB3 is 24bpp, and UYVY is YUV4:2:2 16bpp.
 
Over the normal 2 CSI-2 lanes the data rate is such that RGB3 can run at a maximum of 1080p30, whilst UYVY will go up to 1080p50. Use the following command to select UYVY, however your application may override that.
v4l2-ctl -v pixelformat=UYVY
 
9. Check that the audio drivers / card is available to ALSA.
<pre>
pi@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0 [bcm2835-i2s-dir-hifi dir-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
</pre>
Note: <span style="color:red;">card 1</span> means that the card number for the TC358743XBG is "1" and it might be different.
 
10. Install GStreamer tool;
sudo apt install gstreamer1.0-tools
 
Check gstreamer tool version:
<pre>
pi@raspberrypi:~ $ gst-launch-1.0 --version
gst-launch-1.0 version 1.18.4
GStreamer 1.18.4
http://packages.qa.debian.org/gstreamer1.0
</pre>
 
<span style="color:red;">Note: </span>
 
Different versions have different command line parameters, which is very annoying.
 
11. Use gstreamer to record video and audio
#GStreamer v1.14 command
gst-launch-1.0 v4l2src io-mode=5 ! video/x-raw, format=UYVY, framerate=25/1 ! v4l2h264enc output-io-mode=4 ! video/x-h264,profile=high ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv alsasrc device=hw:1 ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.
 
foo.mkv is the output file.
 
If your gstreamer is version 1.8 or above, you can try the following test command. In addition, alsasrc device=hw:1 represents the sound card of TC358743, you can use "arecord -l" to query.
 
#The command to recode a video with audio. (GStreamer 1.18.4)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,<span style="color:red;">framerate=30/1</span>,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv alsasrc device=hw:1 ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.
 
#The sample command to recode a video without audio. (C779 doesn't support audio)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,'''<span style="color:red;">framerate=30/1</span>''',format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv
 
Press CTRL+C to end recording.
 
PS: We recommend that you modify the above '''<span style="color:red;">framerate</span>''' parameter to the actual frame rate of your HDMI signal, the actual frame rate value is from the result of ''''v4l2-ctl --query-dv-timings'''' command.
[[File:Csi-framerate.png|none]]
 
For the above HDMI device, because the frame rate is 60, so we modify the framerate parameter to 60 like the followint command.
 
Record the video only:
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,'''<span style="color:red;">framerate=60/1</span>''',format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv
 
Record the video and audio: (if your shield supports audio also)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,'''<span style="color:red;">framerate=60/1</span>''',format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv <span style="color:red;">alsasrc device=hw:1</span> ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.
 
Note: <span style="color:red;">alsasrc device=hw:1</span> - "'''1'''" means the audio card number, You must change to correct audio card number.(Query the car number via ''''arecord -'''l', refer to step 9)
 
12. For old raspberry pi os, you can use [[Raspistil]] to take photo.
 
<!--增加评论功能! -->
<comments />