There are now a number of boards that use this chip, such as the Auvidea B10x boards, and now Chinese boards with some random names.
Some of this is covered in the official documentation at https://www.raspberrypi.org/documentati ... 2-usage.md. I'll get these notes into shape here, and then copy them as a sub-page in the docs.
Firstly, use of raspivid or Picamera with this chip is NOT supported. Any post saying that you're trying to use raspivid, Picamera, or other mechanism to use the firmware drivers with this chip will get shut down very fast and abruptly, potentially to the extent of deleting the post.
1. 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.
2. Edit /boot/config.txt to add the line (that will need sudo, and use your preferred editor)
Code: Select all
dtoverlay=tc358743
If (and only if) you have a device such as the Auvidea B102 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
Code: Select all
dtoverlay=tc358743,4lane=1
Code: Select all
pi@raspberrypi:~ $ dmesg | grep cma
[ 0.000000] cma: Reserved 256 MiB at 0x000000001ec00000
Code: Select all
cma=96M
4. 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.
5. 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, but I don't have a specific one to recommend.
If you create a file edid.txt, then you can push this to the device using
Code: Select all
v4l2-ctl --set-edid=file=edid.txt
Your HDMI source should now reconfigure the output resolution and framerate to something that you've said is supported.
6. The driver does NOT automatically switch to the resolution detected. Use the command
Code: Select all
v4l2-ctl --query-dv-timings
You MUST set the timings via "v4l2-ctl --set-dv-bt-timings". You can pass in an index to the detected mode, or use
Code: Select all
v4l2-ctl --set-dv-bt-timings query
Code: Select all
v4l2-ctl -V
7. The chip supports two formats - BGR3 (the default) and UYVY. BGR3 is 24bpp, and UYVY is YUV4:2:2 16bpp.
Over the normal 2 CSI-2 lanes the data rate is such that BGR3 can run at a maximum of 1080p30, whilst UYVY will go up to 1080p50. Use
Code: Select all
v4l2-ctl -v pixelformat=UYVY
You now have a fully configured V4L2 device that will capture the incoming video. Your choice of application to connect to it is totally up to you. GStreamer is a reasonable choice, and a command-line such as
Code: Select all
gst-launch-1.0 v4l2src ! "video/x-raw,framerate=30/1,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=10,video_bitrate=256000;" ! video/x-h264,profile=high ! h264parse ! queue ! matroskamux ! filesink location=foo.mkv
If you have issues, then firstly check the detected timings as at step 6. If it reports 1080p @ 60fps then your source device would appear not to abide by what is advertised via the EDID. Sorry, not much you can do.
You can also check the current status with
Code: Select all
v4l2-ctl --log-status
Code: Select all
root@pi3:~# v4l2-ctl --log-status
Status Log:
[ 1894.774862] unicam 3f801000.csi: ================= START STATUS =================
[ 1894.776553] tc358743 0-000f: -----Chip status-----
[ 1894.777196] tc358743 0-000f: Chip ID: 0x00
[ 1894.777813] tc358743 0-000f: Chip revision: 0x00
[ 1894.777823] tc358743 0-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
[ 1894.777829] tc358743 0-000f: Sleep mode: off
[ 1894.777835] tc358743 0-000f: Cable detected (+5V power): yes
[ 1894.778365] tc358743 0-000f: DDC lines enabled: yes
[ 1894.778890] tc358743 0-000f: Hotplug enabled: yes
[ 1894.779510] tc358743 0-000f: CEC enabled: no
[ 1894.779515] tc358743 0-000f: -----Signal status-----
[ 1894.779521] tc358743 0-000f: TMDS signal detected: yes
[ 1894.779528] tc358743 0-000f: Stable sync signal: yes
[ 1894.779533] tc358743 0-000f: PHY PLL locked: yes
[ 1894.779539] tc358743 0-000f: PHY DE detected: yes
[ 1894.786625] tc358743 0-000f: Detected format: 1920x1080p60.0 (2200x1125)
[ 1894.786638] tc358743 0-000f: horizontal: fp = 0, -sync = 280, bp = 0
[ 1894.786646] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
[ 1894.786653] tc358743 0-000f: pixelclock: 148500000
[ 1894.786662] tc358743 0-000f: flags (0x0):
[ 1894.786669] tc358743 0-000f: standards (0x0):
[ 1894.786680] tc358743 0-000f: Configured format: 1920x1080p60.0 (2200x1125)
[ 1894.786687] tc358743 0-000f: horizontal: fp = 0, -sync = 280, bp = 0
[ 1894.786695] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
[ 1894.786701] tc358743 0-000f: pixelclock: 148500000
[ 1894.786708] tc358743 0-000f: flags (0x0):
[ 1894.786715] tc358743 0-000f: standards (0x0):
[ 1894.786721] tc358743 0-000f: -----CSI-TX status-----
[ 1894.786727] tc358743 0-000f: Lanes needed: 4 <<<<<<<<<<<<<<<<<<<
[ 1894.786733] tc358743 0-000f: Lanes in use: 4
[ 1894.787356] tc358743 0-000f: Waiting for particular sync signal: no
[ 1894.787971] tc358743 0-000f: Transmit mode: no
[ 1894.788596] tc358743 0-000f: Receive mode: no
[ 1894.789210] tc358743 0-000f: Stopped: no
[ 1894.789216] tc358743 0-000f: Color space: RGB 888 24-bit
[ 1894.790258] tc358743 0-000f: -----HDMI status-----
[ 1894.790270] tc358743 0-000f: HDCP encrypted content: no
[ 1894.790278] tc358743 0-000f: Input color space: RGB limited range
[ 1894.791562] tc358743 0-000f: AV Mute: off
[ 1894.792764] tc358743 0-000f: Deep color mode: 8-bits per channel
[ 1894.795271] tc358743 0-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
[ 1894.795281] tc358743 0-000f: colorspace: RGB
[ 1894.795290] tc358743 0-000f: scan mode: No Data
[ 1894.795298] tc358743 0-000f: colorimetry: ITU709
[ 1894.795320] tc358743 0-000f: picture aspect: 16:9
[ 1894.795330] tc358743 0-000f: active aspect: Same as Picture
[ 1894.795339] tc358743 0-000f: itc: No Data
[ 1894.795349] tc358743 0-000f: extended colorimetry: xvYCC 601
[ 1894.795358] tc358743 0-000f: quantization range: Default
[ 1894.795367] tc358743 0-000f: nups: Unknown Non-uniform Scaling
[ 1894.795375] tc358743 0-000f: video code: 16
[ 1894.795384] tc358743 0-000f: ycc quantization range: Limited
[ 1894.795393] tc358743 0-000f: hdmi content type: Graphics
[ 1894.795402] tc358743 0-000f: pixel repeat: 0
[ 1894.795412] tc358743 0-000f: bar top 0, bottom 0, left 0, right 0
[ 1894.795419] unicam 3f801000.csi: -----Receiver status-----
[ 1894.795428] unicam 3f801000.csi: V4L2 width/height: 1920x1080
[ 1894.795435] unicam 3f801000.csi: Mediabus format: 0000100a
[ 1894.795446] unicam 3f801000.csi: V4L2 format: RGB3
[ 1894.795454] unicam 3f801000.csi: Unpacking/packing: 0 / 0
[ 1894.795459] unicam 3f801000.csi: ----Live data----
[ 1894.795466] unicam 3f801000.csi: Programmed stride: 0
[ 1894.795472] unicam 3f801000.csi: Detected resolution: 0x0
[ 1894.795478] unicam 3f801000.csi: Write pointer: 00000000
[ 1894.795485] unicam 3f801000.csi: ================== END STATUS ==================
[ 1894.786727] tc358743 0-000f: Lanes needed: 4
[ 1894.786733] tc358743 0-000f: Lanes in use: 4
exceed the number of data lanes on the device (2) then you are stuck and there is no way forward. You need to force your device to produce a lower resolution or framerate.
Audio
Capturing stereo audio from the HDMI source is supported, but requires some extra wiring to connect in the I2S audio interface. Please refer to the documentation page for that.
Note that this works fine on Auvidea boards, but not on many of the Chinese boards. They appear to have not implemented the audio PLL circuitry correctly - see viewtopic.php?f=44&t=279935 (thanks to idcidc for investigating that). There is no way to fix this in software, so please don't ask.
Add
Code: Select all
dtoverlay=tc358743-audio
The chip does NOT support audio resampling. The V4L2 device has two additional read-only controls to reflect the audio state. The easiest way for the user to view these is "v4l2-ctl --list-ctrls"
Code: Select all
pi@raspberrypi:~ $ v4l2-ctl --list-ctrls
User Controls
audio_sampling_rate 0x00981980 (int) : min=0 max=768000 step=1 default=0 value=48000 flags=read-only
audio_present 0x00981981 (bool) : default=0 value=1 flags=read-only
Something along the lines of
Code: Select all
gst-launch-1.0 v4l2src ! "video/x-raw,framerate=30/1,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=10,video_bitrate=256000;" ! 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.