6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

TC358743 HDMI to CSI-2 install instructions

Wed Aug 05, 2020 7:29 am

viewtopic.php?f=38&t=120702 has become such a long and rambling thread I'm creating this as a sticky for the install instructions.
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
to the end of the file.
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
3. Check the amount of memory assigned to the CMA heap with "dmesg | grep cma". The first line should be along the lines of

Code: Select all

pi@raspberrypi:~ $ dmesg | grep cma
[    0.000000] cma: Reserved 256 MiB at 0x000000001ec00000
If it reports less than 96MB assigned to CMA, then edit /boot/cmdline.txt and add

Code: Select all

cma=96M
to the start of the lne. Do NOT add any carriage returns.

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
If you've hand created the EDID, then adding --fix-edid-checksums means that v4l2-ctl fixes up the checksums for you.
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
to print the currently detected 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
to select the currently detected timings.

Code: Select all

v4l2-ctl -V
should now reflect the resolution detected.

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
to select UYVY, however your application may override that.

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
should save you an MKV file of your incoming video stream.

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
which will log something along the lines of

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  ==================
Unless on a Compute Module, then as the lines
[ 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
IN ADDITION to the dtoverlay=tc358743 line in /boot/config.txt, and it will create the audio device.

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
You MUST match your audio capture to the detected sample rate.

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.
should give you an mkv file with audio and video synchronised from your source. (Note that you MUST update the sample rate in the command line to match the detected incoming audio).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Wed Aug 05, 2020 7:30 am

Older version of these instructions at viewtopic.php?p=1339178#p1339178.
I'm dropping reference to yavta for now - it's a hacked together test app, not production quality code.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

danyex
Posts: 11
Joined: Tue Aug 04, 2020 3:48 pm

Re: TC358743 HDMI to CSI-2 install instructions

Wed Aug 05, 2020 12:08 pm

Nice tutorial :)

I use one of these chinese Boards that you linked in the Audio section..

it seems this board only uses 1 lane and not 4? did i do something wrong? i only get 1-3 FPS with massive delay

here is the log:

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --log-status

Status Log:

   [  829.634089] unicam 20801000.csi: =================  START STATUS  =================
   [  829.641926] tc358743 10-000f: -----Chip status-----
   [  829.642602] tc358743 10-000f: Chip ID: 0x00
   [  829.643253] tc358743 10-000f: Chip revision: 0x00
   [  829.643271] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [  829.643282] tc358743 10-000f: Sleep mode: off
   [  829.643289] tc358743 10-000f: Cable detected (+5V power): yes
   [  829.643844] tc358743 10-000f: DDC lines enabled: yes
   [  829.644425] tc358743 10-000f: Hotplug enabled: yes
   [  829.645112] tc358743 10-000f: CEC enabled: no
   [  829.645126] tc358743 10-000f: -----Signal status-----
   [  829.645133] tc358743 10-000f: TMDS signal detected: yes
   [  829.645140] tc358743 10-000f: Stable sync signal: yes
   [  829.645147] tc358743 10-000f: PHY PLL locked: yes
   [  829.645154] tc358743 10-000f: PHY DE detected: yes
<4>[  829.649002] ------------[ cut here ]------------
<4>[  829.649085] WARNING: CPU: 0 PID: 1499 at drivers/media/platform/bcm2835/bcm2835-unicam.c:716 unicam_wr_dma_addr+0x44/0x9c [bcm2835_unicam]
<4>[  829.649093] Modules linked in: aes_arm aes_generic cmac tc358743 rfcomm bnep spidev hci_uart btbcm bluetooth ecdh_generic ecc libaes 8021q garp stp llc brcmfmac brcmutil sha256_generic libsha256 cfg80211 rfkill raspberrypi_hwmon i2c_mux_pinctrl i2c_mux bcm2835_unicam v4l2_dv_timings v4l2_fwnode i2c_bcm2835 bcm2835_codec(C) v4l2_mem2mem bcm2835_v4l2(C) snd_bcm2835(C) bcm2835_isp(C) spi_bcm2835 bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 snd_pcm videobuf2_common snd_timer snd vc_sm_cma(C) videodev mc uio_pdrv_genirq uio fixed uinput cuse fuse i2c_dev ip_tables x_tables ipv6 nf_defrag_ipv6
<4>[  829.649232] CPU: 0 PID: 1499 Comm: v4l2src0:src Tainted: G        WC        5.4.51+ #1331
<4>[  829.649238] Hardware name: BCM2835
<4>[  829.649242] Backtrace: 
<4>[  829.649269] [<c0014cb4>] (dump_backtrace) from [<c0014fa4>] (show_stack+0x20/0x24)
<4>[  829.649278]  r6:00000009 r5:00000000 r4:00000000 r3:12a3e097
<4>[  829.649297] [<c0014f84>] (show_stack) from [<c074d81c>] (dump_stack+0x20/0x28)
<4>[  829.649318] [<c074d7fc>] (dump_stack) from [<c0023b7c>] (__warn+0xdc/0x100)
<4>[  829.649333] [<c0023aa0>] (__warn) from [<c0023c50>] (warn_slowpath_fmt+0xb0/0xc0)
<4>[  829.649345]  r9:bf393794 r8:000002cc r7:bf38e700 r6:00000009 r5:c0a47028 r4:00000000
<4>[  829.649376] [<c0023ba4>] (warn_slowpath_fmt) from [<bf38e700>] (unicam_wr_dma_addr+0x44/0x9c [bcm2835_unicam])
<4>[  829.649387]  r9:d2950b10 r8:00000000 r7:55d19000 r6:00000000 r5:d2950000 r4:55d18000
<4>[  829.649421] [<bf38e6bc>] (unicam_wr_dma_addr [bcm2835_unicam]) from [<bf38eab4>] (unicam_isr+0x238/0x2f0 [bcm2835_unicam])
<4>[  829.649431]  r7:bf395260 r6:d2950000 r5:00000001 r4:d2950000
<4>[  829.649467] [<bf38e87c>] (unicam_isr [bcm2835_unicam]) from [<c00685d8>] (__handle_irq_event_percpu+0x94/0x1cc)
<4>[  829.649478]  r10:d549c200 r9:d42f7f08 r8:00000000 r7:00000001 r6:0000003f r5:d2b0cac0
<4>[  829.649482]  r4:c0a47028
<4>[  829.649496] [<c0068544>] (__handle_irq_event_percpu) from [<c0068748>] (handle_irq_event_percpu+0x38/0x8c)
<4>[  829.649507]  r10:b3630000 r9:eb80eb80 r8:d5498000 r7:00000001 r6:d549c200 r5:c0add910
<4>[  829.649511]  r4:c0a47028
<4>[  829.649524] [<c0068710>] (handle_irq_event_percpu) from [<c00687d4>] (handle_irq_event+0x38/0x4c)
<4>[  829.649533]  r6:00000000 r5:c0add910 r4:d549c200
<4>[  829.649544] [<c006879c>] (handle_irq_event) from [<c006c8a0>] (handle_level_irq+0xac/0x140)
<4>[  829.649552]  r4:d549c200 r3:0008aa96
<4>[  829.649563] [<c006c7f4>] (handle_level_irq) from [<c0067744>] (generic_handle_irq+0x30/0x44)
<4>[  829.649569]  r4:0000003f r3:c006c7f4
<4>[  829.649582] [<c0067714>] (generic_handle_irq) from [<c0067d94>] (__handle_domain_irq+0x58/0xb8)
<4>[  829.649598] [<c0067d3c>] (__handle_domain_irq) from [<c000a0d0>] (bcm2835_handle_irq+0x28/0x48)
<4>[  829.649609]  r8:00c5387d r7:00c5387d r6:ffffffff r5:c0a479f8 r4:d42f7fb0 r3:d42f7fb0
<4>[  829.649618] [<c000a0a8>] (bcm2835_handle_irq) from [<c0009d6c>] (__irq_usr+0x4c/0x60)
<4>[  829.649626] Exception stack(0xd42f7fb0 to 0xd42f7ff8)
<4>[  829.649637] 7fa0:                                     b41b58a0 b36308c0 000000c0 eb7eeb80
<4>[  829.649647] 7fc0: c382eb7c eb7ca684 eb80eb80 b483dc7c e47d9983 eb80eb80 b3630000 00000000
<4>[  829.649655] 7fe0: e980eb80 b55f2554 00000060 b6ec6b3c 20000010 ffffffff
<4>[  829.649660]  r5:20000010 r4:b6ec6b3c
<4>[  829.649667] ---[ end trace f057df7699a6abce ]---
   [  829.653619] tc358743 10-000f: Detected format: 1280x720p60.0 (1650x750)
   [  829.653643] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [  829.653656] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [  829.653668] tc358743 10-000f: pixelclock: 74250000
   [  829.653678] tc358743 10-000f: flags (0x0):
   [  829.653690] tc358743 10-000f: standards (0x0):
   [  829.653704] tc358743 10-000f: Configured format: 1280x720p60.0 (1650x750)
   [  829.653716] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [  829.653727] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [  829.653735] tc358743 10-000f: pixelclock: 74250000
   [  829.653747] tc358743 10-000f: flags (0x0):
   [  829.653757] tc358743 10-000f: standards (0x0):
   [  829.653765] tc358743 10-000f: -----CSI-TX status-----
   [  829.653777] tc358743 10-000f: Lanes needed: 1
   [  829.653787] tc358743 10-000f: Lanes in use: 1
   [  829.654502] tc358743 10-000f: Waiting for particular sync signal: no
   [  829.655158] tc358743 10-000f: Transmit mode: yes
   [  829.655864] tc358743 10-000f: Receive mode: no
   [  829.656586] tc358743 10-000f: Stopped: no
   [  829.656604] tc358743 10-000f: Color space: YCbCr 422 16-bit
   [  829.657166] tc358743 10-000f: -----HDMI status-----
   [  829.657180] tc358743 10-000f: HDCP encrypted content: no
   [  829.657189] tc358743 10-000f: Input color space: RGB full range
   [  829.657752] tc358743 10-000f: AV Mute: off
   [  829.658337] tc358743 10-000f: Deep color mode: 8-bits per channel
   [  829.661002] tc358743 10-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [  829.661023] tc358743 10-000f:     colorspace: RGB
   [  829.661036] tc358743 10-000f:     scan mode: Underscan
   [  829.661049] tc358743 10-000f:     colorimetry: No Data
   [  829.661061] tc358743 10-000f:     picture aspect: 16:9
   [  829.661074] tc358743 10-000f:     active aspect: Same as Picture
   [  829.661084] tc358743 10-000f:     itc: IT Content
   [  829.661095] tc358743 10-000f:     extended colorimetry: xvYCC 601
   [  829.661107] tc358743 10-000f:     quantization range: Full
   [  829.661119] tc358743 10-000f:     nups: Unknown Non-uniform Scaling
   [  829.661130] tc358743 10-000f:     video code: 4
   [  829.661142] tc358743 10-000f:     ycc quantization range: Limited
   [  829.661154] tc358743 10-000f:     hdmi content type: Graphics
   [  829.661166] tc358743 10-000f:     pixel repeat: 0
   [  829.661181] tc358743 10-000f:     bar top 0, bottom 0, left 0, right 0
   [  829.661196] unicam 20801000.csi: -----Receiver status-----
   [  829.661205] unicam 20801000.csi: V4L2 width/height:   1280x720
   [  829.661216] unicam 20801000.csi: Mediabus format:     0000200f
   [  829.661227] unicam 20801000.csi: V4L2 format:         59565955
   [  829.661238] unicam 20801000.csi: Unpacking/packing:   0 / 0
   [  829.661244] unicam 20801000.csi: ----Live data----
   [  829.661254] unicam 20801000.csi: Programmed stride:   2560
   [  829.661262] unicam 20801000.csi: Detected resolution: 1280x720
   [  829.661272] unicam 20801000.csi: Write pointer:       55d18ff0
   [  829.661283] unicam 20801000.csi: ==================  END STATUS  ==================

Here you can see what i did..

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --set-edid=file=edid.txt --fix-edid-checksum

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
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: 
pi@raspberrypi:~ $ v4l2-ctl --set-dv-bt-timings query
BT timings set
pi@raspberrypi:~ $ v4l2-ctl -V
Format Video Capture:
	Width/Height      : 1280/720
	Pixel Format      : 'RGB3' (24-bit RGB 8-8-8)
	Field             : None
	Bytes per Line    : 3840
	Size Image        : 2764800
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
pi@raspberrypi:~ $ v4l2-ctl -v pixelformat=UYVY
pi@raspberrypi:~ $ 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
Leitung wird auf PAUSIERT gesetzt ...
Leitung ist aktiv und erfordert keinen VORLAUF ?
Leitung wird auf ABSPIELEN gesetzt ...
New clock: GstSystemClock
Verzögerung neu verteilen ?
anything i can do?

thank you for your work! :)


edit:
Raspberry Pi Zero WH

Linux raspberrypi 5.4.51+ #1331 Fri Jul 31 16:40:14 BST 2020 armv6l GNU/Linux

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Wed Aug 05, 2020 1:04 pm

danyex wrote:
Wed Aug 05, 2020 12:08 pm
it seems this board only uses 1 lane and not 4? did i do something wrong? i only get 1-3 FPS with massive delay
The board only NEEDS to use 1 lane to carry the 720p60 UYVY data. That doesn't exceed the 2 lanes that you have available, so you're fine.

The warning over the address is being looked at. It only affects Pi0 and 1 because they have a different cache structure and memory map to the later variants.

I must confess that I put that together as a copy/paste from the older thread, and I haven't tested out the commands out recently. I'll try them quickly now.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

danyex
Posts: 11
Joined: Tue Aug 04, 2020 3:48 pm

Re: TC358743 HDMI to CSI-2 install instructions

Fri Aug 07, 2020 11:17 am

well i think i got it now.. but i have a question..

my goal is to show the hdmi signal from my pc to the raspberry pi zero in a window on the pi

i tried several things with gestream - but only got it to work as an .mkv file on my pi

now i tried it with yavta and used this command on my pc via putty:

Code: Select all

./yavta -c -f UYVY -n 3 --encode-to=- -m -T /dev/video0 | socat - udp-sendto:10.0.0.20:5000
i immediately got an signal on my pi in fullscreen with in 60FPS with no delay.. but i couldnt move or see my mousepointer on the pi till i closed putty on my pc

i dont think i am on the right track.. how could i achieve a minimal delay live feed from the pc to the pi?

danyex
Posts: 11
Joined: Tue Aug 04, 2020 3:48 pm

Re: TC358743 HDMI to CSI-2 install instructions

Mon Aug 10, 2020 11:54 am

so is there no way to achieve a minimal delay live feed from the pc to the pi in a small window?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Mon Aug 10, 2020 12:20 pm

danyex wrote:
Fri Aug 07, 2020 11:17 am
well i think i got it now.. but i have a question..

my goal is to show the hdmi signal from my pc to the raspberry pi zero in a window on the pi

i tried several things with gestream - but only got it to work as an .mkv file on my pi

now i tried it with yavta and used this command on my pc via putty:

Code: Select all

./yavta -c -f UYVY -n 3 --encode-to=- -m -T /dev/video0 | socat - udp-sendto:10.0.0.20:5000
i immediately got an signal on my pi in fullscreen with in 60FPS with no delay.. but i couldnt move or see my mousepointer on the pi till i closed putty on my pc

i dont think i am on the right track.. how could i achieve a minimal delay live feed from the pc to the pi?
danyex wrote:
Mon Aug 10, 2020 11:54 am
so is there no way to achieve a minimal delay live feed from the pc to the pi in a small window?
yavta is a test app - Yet Another V4L2 Test Application. It is NOT meant to be a solution too all situations (same as raspivid and raspistill aren't).
You'll note that this thread is meant to be install instructions, and I don't even reference yavta.
The fact that it throws up a preview on top of the framebuffer of the local machine is just the way it is. Your mousepointer and desktop are just hidden behind that layer. Please feel free to modify the code to fit your situation, but I'm not proposing making yavta a supported application.

Set the timings correctly first (v4l2-ctl --set-dv-bt-timings query), then something like

Code: Select all

gst-launch-1.0 v4l2src ! "video/x-raw,framerate=60/1,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=10,video_bitrate=4000000,repeat_sequence_header=1;" ! video/x-h264,profile=high ! udpsink host=10.0.0.20 port=5000
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

scrummando
Posts: 1
Joined: Thu Aug 13, 2020 3:27 pm

Re: TC358743 HDMI to CSI-2 install instructions

Thu Aug 13, 2020 4:01 pm

I am a loss for where the EDID file needs to go in the File directory... I am trying to connect a Canon HF r800 which it's live HDMI out is at a full 1080p 60fs and can't be adjusted.

PI4 B 4gb ram running Buster as the version of the Os.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Wed Sep 09, 2020 1:08 pm

scrummando wrote:
Thu Aug 13, 2020 4:01 pm
I am a loss for where the EDID file needs to go in the File directory... I am trying to connect a Canon HF r800 which it's live HDMI out is at a full 1080p 60fs and can't be adjusted.

PI4 B 4gb ram running Buster as the version of the Os.
You put it wherever you want, and load it with "v4l2-ctl --set-edid=file=edid.txt" (assuming edid.txt is the name of your edid file)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Ebad
Posts: 11
Joined: Tue Aug 16, 2016 11:57 am

Re: TC358743 HDMI to CSI-2 install instructions

Thu Oct 15, 2020 5:45 am

Thank you so much for such an amazing tutorial 6by9.

I can successfully test my stream through YAVTA and it works perfectly. So does saving the stream to Matroska file.

However, I would like to playback the stream directly on the output like YAVTA. Autovideo sink has a terrible lag and xvimage sink doesn't work. Can you point me to the right direction ? or the correct method for such a pipeline. I am new to GSTREAMER and using it for the first time.

Thank You again

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Thu Oct 15, 2020 7:27 am

Ebad wrote:
Thu Oct 15, 2020 5:45 am
Thank you so much for such an amazing tutorial 6by9.

I can successfully test my stream through YAVTA and it works perfectly. So does saving the stream to Matroska file.

However, I would like to playback the stream directly on the output like YAVTA. Autovideo sink has a terrible lag and xvimage sink doesn't work. Can you point me to the right direction ? or the correct method for such a pipeline. I am new to GSTREAMER and using it for the first time.
Assuming a Pi4 (or other device with vc4-fkms-v3d or vc4-kms-v3d loaded), boot to the console (not to the desktop), and use kmssink.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamiebasil
Posts: 2
Joined: Fri Nov 06, 2020 3:28 pm

Re: TC358743 HDMI to CSI-2 install instructions

Sun Nov 15, 2020 7:42 pm

Yes! thank you so much for these instructions 6by9. I followed all of it and I've hit a wall when I try to capture video.

Using your sample code:

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

I get this output:

Code: Select all

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0: Failed to process frame.
Additional debug info:
gstv4l2videoenc.c(803): gst_v4l2_video_enc_handle_frame (): /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0:
Maybe be due to not enough memory or failing driver
Execution ended after 0:00:00.197212790
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
It's failing to process the frame for some reason.

I've also tried using different applications to capture video and I've received the following messages:

Using ffmpeg:

Code: Select all

]pi@raspberrypi:~ $ ffplay /dev/video0
[video4linux2,v4l2 @ 0x63b00720] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0x63b00720] Time per frame unknown
[video4linux2,v4l2 @ 0x63b00720] Stream #0: not enough frames to estimate rate; consider increasing probesize

Yes this displays video but it's very slow and I'm not in full understanding of these messages and how to fix.


Using gstreamer:

Code: Select all

]pi@raspberrypi:~ $ gst-launch-1.0
ERROR: pipeline could not be constructed: empty pipeline not allowed
No. Doesn't display video.


Using cheese:

Code: Select all

pi@raspberrypi:~ $ cheese
(cheese:6260): cheese-WARNING **: 15:03:54.592: Failed to allocate required memory.: gstv4l2src.c(658): gst_v4l2sr$
Buffer pool activation failed
No. Doesn't display video. Message on the app screen that says "There was an error playing video from the webcam"


Running v4l2 compliance seems like the info checks out except for buffer ioctls check. Maybe something related to memory allocating buffer space?

Code: Select all

pi@raspberrypi:~ $ v4l2-compliance
v4l2-compliance SHA: not available, 32 bits
Compliance test for device /dev/video0:
Driver Info:
	Driver name      : unicam
	Card type        : unicam
	Bus info         : platform:3f801000.csi
	Driver version   : 5.4.75
	Capabilities     : 0x85a00001
		Video Capture
		Metadata Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x05200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : unicam
	Model            : unicam
	Serial           : 
	Bus info         : platform:3f801000.csi
	Media version    : 5.4.75
	Hardware revision: 0x00000000 (0)
	Driver version   : 5.4.75
Interface Info:
	ID               : 0x03000005
	Type             : V4L Video
Entity Info:
	ID               : 0x00000003 (3)
	Name             : unicam-image
	Function         : V4L2 I/O
	Flags         : default
	Pad 0x01000004   : 0: Sink
	  Link 0x02000007: from remote pad 0x1000002 of entity 'tc358743 10-000f': Data, Enabled, Immutable

Buffer ioctls (Input 0):
		fail: v4l2-test-buffers.cpp(485): check_0(reqbufs.reserved, sizeof(reqbufs.reserved))
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL


Another thing I've noticed is that I have a lot of video devices listed when I run:

Code: Select all

pi@raspberrypi:~ $ ls -al /dev/video*
crw-rw----+ 1 root video 81, 7 Nov 15 02:40 /dev/video0
crw-rw----+ 1 root video 81, 8 Nov 15 02:40 /dev/video1
crw-rw----+ 1 root video 81, 4 Nov 15 02:40 /dev/video10
crw-rw----+ 1 root video 81, 5 Nov 15 02:40 /dev/video11
crw-rw----+ 1 root video 81, 6 Nov 15 02:40 /dev/video12
crw-rw----+ 1 root video 81, 0 Nov 15 02:40 /dev/video13
crw-rw----+ 1 root video 81, 1 Nov 15 02:40 /dev/video14
crw-rw----+ 1 root video 81, 2 Nov 15 02:40 /dev/video15
crw-rw----+ 1 root video 81, 3 Nov 15 02:40 /dev/video16
Could this be an issue?

Any help or explanation with any of the messages would be greatly appreciated.
Thank you!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Sun Nov 15, 2020 8:59 pm

Those /dev/videoX nodes are all expected.
0 is the Unicam image node
1 is the Unicam metadata node (not actually relevant here)
10 is the video decoder
11 is the video encoder
12 is the simple video conversion/resize using the ISP
13-16 are the more complex ISP. 13 is the input, 14 hi res output, 15 low res output, 16 stats output.

Most likely you're running out of memory. Simplest answer is to add "dtoverlay=cma,cma-128" to config.txt to increase the size of the CMA heap. The earlier recommendation of editing cmdline.txt needs to be updated.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aheirich
Posts: 4
Joined: Sun Nov 15, 2020 7:23 pm

Re: TC358743 HDMI to CSI-2 install instructions

Thu Nov 26, 2020 9:29 pm

Thank you for the comprehensive intro. I have followed the steps but still cannot get a signal.

I have an Iphone SE connected through a Lightning-to-HDMI adapter to the HDMI input of an Auvidea B101 rev 4 connected to the camera input on a brand new Raspberry pi 4.

I edited /boot/config.txt to add

dtoverlay=tc358743

I installed an EDID file from

https://github.com/6by9/CSI2_device_con ... 60EDID.txt

v4l2-ctl --set-edid=file=1080P60EDIID.edid

and rebooted. I see a new video device

pi@raspberrypi:~ $ ls -lt /dev/video*
crw-rw-rw- 1 root video 234, 2 Nov 26 12:52 /dev/video2

I have started the camera app on the iphone in video mode. It should be automatically mirroring to the HDMI connection.

Now when I query the device I see

Code: Select all

pi@raspberrypi:~ $ dmesg | grep cma
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Memory: 7748116K/8192000K available (10240K kernel code, 745K rwdata, 2808K rodata, 2048K init, 856K bss, 181740K reserved, 262144K cma-reserved, 7405568K highmem)
[    5.030714] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    5.033126] bcm2835_vc_sm_cma_probe: Videocore shared memory driver

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl -d /dev/video2 --query-dv-timings
Failed to open /dev/video2: Operation not permitted

Code: Select all

pi@raspberrypi:~ $ ls -lt /dev/video*
crw-rw-rw-  1 root video 234, 2 Nov 26 12:52 /dev/video2
crw-rw-rw-+ 1 root video  81, 8 Nov 22 15:17 /dev/video1
crw-rw-rw-+ 1 root video  81, 7 Nov 22 15:17 /dev/video0
crw-rw-rw-+ 1 root video  81, 5 Nov 22 15:17 /dev/video11
crw-rw-rw-+ 1 root video  81, 6 Nov 22 15:17 /dev/video12
crw-rw-rw-+ 1 root video  81, 4 Nov 22 15:17 /dev/video10
crw-rw-rw-+ 1 root video  81, 1 Nov 22 15:17 /dev/video14
crw-rw-rw-+ 1 root video  81, 0 Nov 22 15:17 /dev/video13
crw-rw-rw-+ 1 root video  81, 2 Nov 22 15:17 /dev/video15
crw-rw-rw-+ 1 root video  81, 3 Nov 22 15:17 /dev/video16

Code: Select all

v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16

unicam (platform:fe801000.csi):
	/dev/video0
	/dev/video1

Code: Select all

v4l2-ctl --log-status

Status Log:

   [ 1741.292730] unicam fe801000.csi: =================  START STATUS  =================
   [ 1741.295239] tc358743 10-000f: -----Chip status-----
   [ 1741.295885] tc358743 10-000f: Chip ID: 0x00
   [ 1741.296549] tc358743 10-000f: Chip revision: 0x00
   [ 1741.296562] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 1741.296572] tc358743 10-000f: Sleep mode: off
   [ 1741.296582] tc358743 10-000f: Cable detected (+5V power): no
   [ 1741.297143] tc358743 10-000f: DDC lines enabled: yes
   [ 1741.297699] tc358743 10-000f: Hotplug enabled: no
   [ 1741.298357] tc358743 10-000f: CEC enabled: no
   [ 1741.298368] tc358743 10-000f: -----Signal status-----
   [ 1741.298378] tc358743 10-000f: TMDS signal detected: no
   [ 1741.298387] tc358743 10-000f: Stable sync signal: no
   [ 1741.298397] tc358743 10-000f: PHY PLL locked: no
   [ 1741.298406] tc358743 10-000f: PHY DE detected: no
   [ 1741.298965] tc358743 10-000f: No video detected
   [ 1741.298982] tc358743 10-000f: Configured format: 0x0p0.0 (0x0)
   [ 1741.298994] tc358743 10-000f: horizontal: fp = 0, -sync = 0, bp = 0
   [ 1741.299005] tc358743 10-000f: vertical: fp = 0, -sync = 0, bp = 0
   [ 1741.299015] tc358743 10-000f: pixelclock: 0
   [ 1741.299028] tc358743 10-000f: flags (0x0):
   [ 1741.299038] tc358743 10-000f: standards (0x0):
   [ 1741.299048] tc358743 10-000f: -----CSI-TX status-----
   [ 1741.299058] tc358743 10-000f: Lanes needed: 0
   [ 1741.299068] tc358743 10-000f: Lanes in use: 1
   [ 1741.299735] tc358743 10-000f: Waiting for particular sync signal: no
   [ 1741.300377] tc358743 10-000f: Transmit mode: no
   [ 1741.301018] tc358743 10-000f: Receive mode: no
   [ 1741.301653] tc358743 10-000f: Stopped: no
   [ 1741.301664] tc358743 10-000f: Color space: RGB 888 24-bit
   [ 1741.302199] tc358743 10-000f: -----DVI-D status-----
   [ 1741.302210] tc358743 10-000f: HDCP encrypted content: no
   [ 1741.302220] tc358743 10-000f: Input color space: RGB full range
   [ 1741.302759] unicam fe801000.csi: -----Receiver status-----
   [ 1741.302771] unicam fe801000.csi: V4L2 width/height:   16x16
   [ 1741.302783] unicam fe801000.csi: Mediabus format:     0000100a
   [ 1741.302794] unicam fe801000.csi: V4L2 format:         33424752
   [ 1741.302807] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 1741.302816] unicam fe801000.csi: ----Live data----
   [ 1741.302827] unicam fe801000.csi: Programmed stride:      0
   [ 1741.302837] unicam fe801000.csi: Detected resolution: 0x0
   [ 1741.302848] unicam fe801000.csi: Write pointer:       00000000
   [ 1741.302861] unicam fe801000.csi: ==================  END STATUS  =========
So there is no detected video signal coming into the HMDI. What can I try next?

thanks in advance

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Fri Nov 27, 2020 11:08 am

aheirich wrote:
Thu Nov 26, 2020 9:29 pm

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl -d /dev/video2 --query-dv-timings
Failed to open /dev/video2: Operation not permitted
Why are you trying to use /dev/video2?
aheirich wrote:

Code: Select all

v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16

unicam (platform:fe801000.csi):
	/dev/video0
	/dev/video1
This lists the unicam device as being /dev/video0 (and /dev/video1, but that node is irrelevant for TC358743).
aheirich wrote:

Code: Select all

v4l2-ctl --log-status

Status Log:

   [ 1741.292730] unicam fe801000.csi: =================  START STATUS  =================
   [ 1741.295239] tc358743 10-000f: -----Chip status-----
   [ 1741.295885] tc358743 10-000f: Chip ID: 0x00
   [ 1741.296549] tc358743 10-000f: Chip revision: 0x00
   [ 1741.296562] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 1741.296572] tc358743 10-000f: Sleep mode: off
   [ 1741.296582] tc358743 10-000f: Cable detected (+5V power): no
   [ 1741.297143] tc358743 10-000f: DDC lines enabled: yes
   [ 1741.297699] tc358743 10-000f: Hotplug enabled: no
   [ 1741.298357] tc358743 10-000f: CEC enabled: no
   [ 1741.298368] tc358743 10-000f: -----Signal status-----
   [ 1741.298378] tc358743 10-000f: TMDS signal detected: no
   [ 1741.298387] tc358743 10-000f: Stable sync signal: no
   [ 1741.298397] tc358743 10-000f: PHY PLL locked: no
   [ 1741.298406] tc358743 10-000f: PHY DE detected: no
   [ 1741.298965] tc358743 10-000f: No video detected
   [ 1741.298982] tc358743 10-000f: Configured format: 0x0p0.0 (0x0)
   [ 1741.298994] tc358743 10-000f: horizontal: fp = 0, -sync = 0, bp = 0
   [ 1741.299005] tc358743 10-000f: vertical: fp = 0, -sync = 0, bp = 0
   [ 1741.299015] tc358743 10-000f: pixelclock: 0
   [ 1741.299028] tc358743 10-000f: flags (0x0):
   [ 1741.299038] tc358743 10-000f: standards (0x0):
   [ 1741.299048] tc358743 10-000f: -----CSI-TX status-----
   [ 1741.299058] tc358743 10-000f: Lanes needed: 0
   [ 1741.299068] tc358743 10-000f: Lanes in use: 1
   [ 1741.299735] tc358743 10-000f: Waiting for particular sync signal: no
   [ 1741.300377] tc358743 10-000f: Transmit mode: no
   [ 1741.301018] tc358743 10-000f: Receive mode: no
   [ 1741.301653] tc358743 10-000f: Stopped: no
   [ 1741.301664] tc358743 10-000f: Color space: RGB 888 24-bit
   [ 1741.302199] tc358743 10-000f: -----DVI-D status-----
   [ 1741.302210] tc358743 10-000f: HDCP encrypted content: no
   [ 1741.302220] tc358743 10-000f: Input color space: RGB full range
   [ 1741.302759] unicam fe801000.csi: -----Receiver status-----
   [ 1741.302771] unicam fe801000.csi: V4L2 width/height:   16x16
   [ 1741.302783] unicam fe801000.csi: Mediabus format:     0000100a
   [ 1741.302794] unicam fe801000.csi: V4L2 format:         33424752
   [ 1741.302807] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 1741.302816] unicam fe801000.csi: ----Live data----
   [ 1741.302827] unicam fe801000.csi: Programmed stride:      0
   [ 1741.302837] unicam fe801000.csi: Detected resolution: 0x0
   [ 1741.302848] unicam fe801000.csi: Write pointer:       00000000
   [ 1741.302861] unicam fe801000.csi: ==================  END STATUS  =========
So there is no detected video signal coming into the HMDI. What can I try next?
Did you send the EDID to /dev/video0 or /dev/video2? No EDID will mean the source won't create any output.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aheirich
Posts: 4
Joined: Sun Nov 15, 2020 7:23 pm

Re: TC358743 HDMI to CSI-2 install instructions

Mon Nov 30, 2020 12:15 am

I see my problem is a bad EDID file. The ones at github.com/6by9/CSI2_device_config has checksum failures.

Can anyone suggest where to get a valid EDID file?

trejan
Posts: 4441
Joined: Tue Jul 02, 2019 2:28 pm

Re: TC358743 HDMI to CSI-2 install instructions

Mon Nov 30, 2020 1:01 am

aheirich wrote:
Mon Nov 30, 2020 12:15 am
I see my problem is a bad EDID file. The ones at github.com/6by9/CSI2_device_config has checksum failures.
6by9 hand modified those two EDID files so the checksums aren't valid. You need to use --fix-edid-checksums when loading them. 6by9 tells you to add that parameter in the other thread where you got the link to the EDID files.

aheirich
Posts: 4
Joined: Sun Nov 15, 2020 7:23 pm

Re: TC358743 HDMI to CSI-2 install instructions

Mon Nov 30, 2020 3:06 am

That did it -- now I am receiving a signal. The problem was the edid all along.

mpmm366
Posts: 2
Joined: Thu Jun 28, 2018 1:02 pm

Re: TC358743 HDMI to CSI-2 install instructions

Tue Dec 22, 2020 9:37 am

First of all, thank you for the great instructions, I have been researching this topic for ages already.
I followed your instructions which worked perfectly to receive the video from my MacBook, but unfortunately, I can't get my action camera to work. The problem is when setting the timing.

Code: Select all

v4l2-ctl --query-dv-timings                                                               

           VIDIOC_QUERY_DV_TIMINGS: failed: Numerical result out of range            
                                                    
Active width: 0                                                                                                         Active height: 0                                                                                                        Total width: 0                                                                                                          Total height: 0                                                                                                         Frame format: progressive                                                                                               Polarities: -vsync -hsync                                                                                               Pixelclock: 0 Hz                                                                                                        Horizontal frontporch: 0                                                                                                Horizontal sync: 0                                                                                                      Horizontal backporch: 0                                                                                                 Vertical frontporch: 0                                                                                                  Vertical sync: 0                                                                                                        Vertical backporch: 0                                                                                                   Standards:                                                                                                              Flags:                   
Can I do something about it, or is it hardware related? It is a cheap Chinese action camera.

Edit: I used the edid file from 6by9 but also tried another edid file with 720P30 resolution.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Tue Dec 22, 2020 6:33 pm

mpmm366 wrote:
Tue Dec 22, 2020 9:37 am
First of all, thank you for the great instructions, I have been researching this topic for ages already.
I followed your instructions which worked perfectly to receive the video from my MacBook, but unfortunately, I can't get my action camera to work. The problem is when setting the timing.

Code: Select all

v4l2-ctl --query-dv-timings                                                               

           VIDIOC_QUERY_DV_TIMINGS: failed: Numerical result out of range            
                                                    
Active width: 0                                                                                                        
Active height: 0                                                                                                       
Total width: 0                                                                                                         
Total height: 0                                                                                                         
Frame format: progressive                                                                                               
Polarities: -vsync -hsync                                                                                               
Pixelclock: 0 Hz                                                                                                        
Horizontal frontporch: 0                                                                                                
Horizontal sync: 0                                                                                                      
Horizontal backporch: 0                                                                                                 
Vertical frontporch: 0                                                                                                  
Vertical sync: 0                                                                                                       
Vertical backporch: 0                                                                                                   
Standards:                                                                                                              
Flags:                   
Can I do something about it, or is it hardware related? It is a cheap Chinese action camera.

Edit: I used the edid file from 6by9 but also tried another edid file with 720P30 resolution.
Use "v4l2-ctl --log-status" to get the lower level debug from the TC358743. Does it believe it has a TMDS signal at all?

I'd be surprised if an action camera used HDCP (copy protection), but the TC358743 won't accept it.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PRAWLN
Posts: 1
Joined: Wed Dec 30, 2020 3:55 am

Re: TC358743 HDMI to CSI-2 install instructions

Wed Dec 30, 2020 4:03 am

Hey all,

I was wondering if anyone had been able to get this to work with Octoprint?
I'm looking to use this on my 3d printer but for the life of me cannot get it to work.

Octoprint uses the Raspberry Pi's ip address then "/webcam/?action=stream" to view the stream and it uses mjpg-streamer.

The board I got is one from "GeekWorm" from Amazon and says it can support up to 1080P 25fps. (I did a tone of googling but could only give a EDID file that was for 1080P 50.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Wed Dec 30, 2020 2:15 pm

PRAWLN wrote:
Wed Dec 30, 2020 4:03 am
Hey all,

I was wondering if anyone had been able to get this to work with Octoprint?
I'm looking to use this on my 3d printer but for the life of me cannot get it to work.

Octoprint uses the Raspberry Pi's ip address then "/webcam/?action=stream" to view the stream and it uses mjpg-streamer.

The board I got is one from "GeekWorm" from Amazon and says it can support up to 1080P 25fps. (I did a tone of googling but could only give a EDID file that was for 1080P 50.
It might with some tweaking.

https://github.com/jacksonliam/mjpg-streamer says that it adds support for the PI camera (using MMAL). That is not an option here as the TC358743 uses V4L2.
The input_uvc module might work as UVC (USB Video Class) is represented via V4L2, but it implies that it requires the source to support JPEG or MJPEG, which the TC35873 doesn't.

The EDID lists the input modes that the HDMI sink device supports. The one for 1080p50 lists resolutions up to and including 1080p50, not just 1080p50.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rma153
Posts: 73
Joined: Sat Nov 12, 2016 6:17 am

Re: TC358743 HDMI to CSI-2 install instructions

Sun Feb 07, 2021 4:22 am

You say "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.

The HAT for my My RPi 4B is at 4.9 (unfortunately, it won't be supporting kernel 5.4 I'm told). What will happen if I follow your instructions without updating to 5.4 (i.e., stay at 4.9)?
To continue to use the B101 on the RPi4B, I need to use v4l2 (I need to connect my GoPro HDMI with my B101 connected to my RPi4B using Gstreamer to stream 1080P video UDP to my laptop). This worked fine on my RPi3B of course.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12823
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: TC358743 HDMI to CSI-2 install instructions

Sun Feb 07, 2021 9:03 am

rma153 wrote:
Sun Feb 07, 2021 4:22 am
You say "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.

The HAT for my My RPi 4B is at 4.9 (unfortunately, it won't be supporting kernel 5.4 I'm told). What will happen if I follow your instructions without updating to 5.4 (i.e., stay at 4.9)?
To continue to use the B101 on the RPi4B, I need to use v4l2 (I need to connect my GoPro HDMI with my B101 connected to my RPi4B using Gstreamer to stream 1080P video UDP to my laptop). This worked fine on my RPi3B of course.
Well the supported kernel has now been updated again and is 5.10.
What is this stick in the mud Hat? 4.9 is ancient, and 4.19 only slightly less so. Not updating means the potential of security issues.

The firmware drivers exist and should still work, but they are unsupported in that they will not be updated at all. Do not expect to get support for audio capture through the firmware drivers.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rma153
Posts: 73
Joined: Sat Nov 12, 2016 6:17 am

Re: TC358743 HDMI to CSI-2 install instructions

Tue Feb 09, 2021 4:01 am

Well, I meant to type that the HAT is currently at 4.19.127. Nonetheless, when asked about this, the vendor's response back was terribly disappointing - "Your request is noted! Currently, we don’t have plans on updating the kernel version on our image."
So, I have no other choice but to hope your instructions will work on 4.19.127. I hope so. I have to say, the effort and commitment to developing the solution in this thread has been nothing short of extraordinary.

Return to “Graphics, sound and multimedia”