Template:C792 / C790 / C779 Software Demo

From Geekworm Wiki
Revision as of 18:10, 28 February 2026 by Ruby (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This guide depends on the version of the official Raspberry Pi OS you are using; instructions vary by OS version. Please contact us if you encounter any issues during use.

Preparation

For kernel driver usage, ensure your system is updated. As the 5.4 kernel included key changes, these guidelines are valid for kernel 5.4 and newer releases. Verify your kernel version with uname -a; if it is below 5.4, fix this before continuing.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux

1. Update and upgrade your Raspberry Pi system (time required varies by country/region).

sudo apt-get update
sudo apt-get upgrade

2. Enable the camera module (enabled by default on Raspberry Pi Bullseye OS).

sudo raspi-config
sudo reboot

3. Go to Interface Options, select Camera and enable it. Select Finish, then reboot your Raspberry Pi. (Reboot is required!)



As the Pi 5B lacks hardware encoding support, the software instructions for Raspberry Pi platforms are currently split into two sections:

  • For other Raspberry Pi platforms (Pi Zero, Zero 2, Pi3B, Pi4B…)
  • For Pi 5B & CM5

Demo for All Pi Models Except Pi 5B & CM5

The HDMI to CSI Module Example for Zero, Zero 2, Pi 3B, Pi 4B…


[STEP1]

  • Edit the /boot/firmware/config.txt file (sudo privileges required):
sudo nano /boot/firmware/config.txt


[STEP2]

  • Add the line:
dtoverlay=tc358743
  • Add the line if your shield support audio like C790 or C792:
dtoverlay=tc358743-audio
  • Add the line only if: your device (e.g., C790/C792) supports a 22-pin connector with all 4 lanes connected, and the compute module has the CAM1 interface with all 4 lanes connected:
dtoverlay=tc358743,4lane=1


[STEP3]

  • Use the following command to check the amount of memory allocated to the CMA heap:
dmesg | grep cma
  • The first line should look like:
pi@raspberrypi:~ $ dmesg | grep cma
[0.000000] cma: Reserved 256 MiB at 0x000000001ec00000
  • If the reported CMA allocated memory is less than 96MB, edit the /boot/cmdline.txt file and add the following at the start of the line (do not add a newline character):
cma=96M


[STEP4]

  • Reboot the device. If everything works properly, you should see the /dev/video0 device, and running the following command will show it is provided by Unicam:
v4l2-ctl --list-devices


[STEP5]

  • After connecting all cables, power on the Raspberry Pi and enter the commands below:
pi@raspberrypi:~ $ ls /dev/video0
/dev/video0
pi@raspberrypi:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
    /dev/video10
    /dev/video11
    /dev/video12
    /dev/video18
    /dev/media1
bcm2835-isp (platform:bcm2835-isp):
    /dev/video13
    /dev/video14
    /dev/video15
    /dev/video16
    /dev/media0
unicam (platform:fe801000.csi):
    /dev/video0
    /dev/video1
    /dev/media2
NOTE: This driver gives full control to the user or the user's applications. By default, no EDID (Extended Display Identification Data) is loaded in the chip, so it cannot inform the HDMI source of the supported resolutions.
  • Several EDID editors are available on the market. You need to first create an edid.txt file (you can use the command nano edid.txt to create and edit the file), then copy the content below into the edid.txt file:
00ffffffffffff005262888800888888
1c150103800000780aEE91A3544C9926
0F505400000001010101010101010101
010101010101011d007251d01e206e28
5500c48e2100001e8c0ad08a20e02d10
103e9600138e2100001e000000fc0054
6f73686962612d4832430a20000000FD
003b3d0f2e0f1e0a2020202020200100
020321434e041303021211012021a23c
3d3e1f2309070766030c00300080E300
7F8c0ad08a20e02d10103e9600c48e21
0000188c0ad08a20e02d10103e960013
8e210000188c0aa01451f01600267c43
00138e21000098000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
  • After the edid.txt file is created, execute the command v4l2-ctl --set-edid=file=edid.txt --fix-edid-checksums in the terminal, and you will see output similar to the following:
    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


[STEP6]

  • Detect the presence of HDMI signal input at present via command:
    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: 
  • Use the command v4l2-ctl --set-dv-bt-timings query to make the driver automatically set the video timing parameters (such as resolution and frame rate) based on the current HDMI input signal, ensuring the capture card correctly recognizes and processes the current HDMI signal.


The chip supports two formats — BGR3 (default) and UYVY. BGR3 is 24bpp, while UYVY is YUV4:2:2 16bpp.
On the standard two CSI-2 lanes, the data rate allows BGR3 to support up to 1080p30, whereas UYVY can support up to 1080p50.


  • Use the following command to select UYVY (however, your application may override this setting):
v4l2-ctl -v pixelformat=UYVY


[STEP7]

  • Check if the audio driver/sound card is available for ALSA:
    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  
NOTE: card 1 means the audio card number for the TC358743XBG is 1. This number may vary.


[STEP8]

  • Install the GStreamer tools:
sudo apt install gstreamer1.0-tools
  • Check the GStreamer tool version:
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
NOTE: Command-line arguments may vary across different versions, which can be confusing.

[Application Example — Using 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 version is 1.8 or higher, you can try the following test command. Additionally, alsasrc device=hw:1 refers to the sound card for TC358743; you can check this with the command arecord -l.

# Command to record video with audio(GStreamer 1.18.4)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=30/1,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.

# Example command to record video without audio (C779 does not support audio)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=30/1,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 stop the recording.

Important Note: We recommend you set the above framerate parameter to the actual frame rate of your HDMI signal. You can get this value from the output of the command v4l2-ctl --query-dv-timings.

thumb 600px

For the HDMI device mentioned above, since the frame rate is 60, we set the framerate parameter to 60, as shown in the following command:

  • Record video only:
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=60/1,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 video and audio (if your module supports audio):
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=60/1,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.
NOTE: The "1" in alsasrc device=hw:1 is the sound card number, and you must change it to the correct one.(Check the sound card number with the arecord -l command)


Demo for Pi 5B & CM5




User Manual

  • Hardware Installation:
  • How to make it work:

FAQ

Q1: Question 1

A: Place the answer here.

Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.