HarutakaMatsumoto
Posts: 2
Joined: Tue Sep 22, 2020 9:28 am

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed Sep 23, 2020 7:31 am

Thanks.
I'm sorry for not reading latest posts.

HotJollof
Posts: 1
Joined: Tue Dec 10, 2019 9:13 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri Sep 25, 2020 2:05 am

Thank you @6by9 for the great information, it has greatly helped me on a project I have been working on where I am taking the feed from a regular camcorder and using araspberrypi4 and a google edgetpu to perform facial recognition on the video feed.

I find myself continuously having to run these three commands every time I need to run my program, and I was wondering if these could be automated in python with the os or subprocess module.

When I run them in sequence like below I get errors like "VIDIOC_QUERY_DV_TIMINGS: failed: Link has been severed"

subprocess.run(['v4l2-ctl', '--set-edid=file=1080P50EDID.txt', '--fix-edid-checksums'], capture_output=True)
subprocess.run(['v4l2-ctl', '--query-dv-timings'])
subprocess.run(['./yavta --capture=10 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0'], shell=True)

However if I only run only one like below, I get the expected results.

subprocess.run(['v4l2-ctl', '--query-dv-timings'])

Any insights into what is causing the issue?
6by9 wrote:
Tue Jul 10, 2018 2:27 pm
*Edited with updated instructions on setting timings*

Finally got there. The drivers and dtoverlays are all merged and released via rpi-update!
Things aren't quite as clean as they could be on the device tree front, but that clean up will come later.

edit First please edit /boot/cmdline.txt and add or edit the "cma=" entry to read "cma=32M", or potentially larger if you want to allocate lots of video buffers. 32M should be sufficient for 3 1080P RGB frames.

After updating, adding

Code: Select all

dtoverlay=tc358743
to /boot/config.txt should be all that is needed on a Pi 3B or 3B+, and you should get a /dev/video0 node (or whatever is the lowest unallocated V4L2 device number).
For a 0, 0W, B+, or 2B, add

Code: Select all

dtoverlay=tc358743,i2c_pins_28_29=1
On a CM or CM3, you need to decide which pins you're connecting up, and then choose either the same as the 3B/3B+ if 44&45, or the 0/0W/B+/2B if using 28&29. Yes you could use 0&1, but I haven't added parameters for that. You can also add "4lane=1" if using the CAM1 connector and have a B102 to be able to achieve 1080P60 (1080P50 UYVY is the maximum available on 2 lanes).
I have not added support for the original A/B as there are too many variations for this round.

As already discussed in this thread, you need to provide an EDID so that the HDMI source knows what resolutions and frame rates are supported. There are example EDID files in https://github.com/6by9/CSI2_device_config for 1080P50 and 1080P60. There is no such thing as a correct EDID for all use cases, so you may want to edit it (not trivial, but there are various programs to help out).
Load the EDID with a command such as

Code: Select all

v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums 
A slight quirk of V4L2 is that whilst the source device will detect the incoming video standard, it does not select it.

Code: Select all

v4l2-ctl --query-dv-timings
will display the detected values. There isn't an easy way to then immediately set the detected mode, and the output resolution is set based on that rather than being able to set the resolution. (it's a trivial app to write - I may see if I can find 5 mins. It'd actually be a useful addition to v4l2-ctl, so I'll see if I can get that upstreamed too).
Run

Code: Select all

v4l2-ctl --set-dv-bt-timings query
and it'll set the current timings to match those that are detected on the input.

The default output format is RGB888 (24bpp), but the device also supports UYVY (YUV422 16bpp). The video_encode component should also now support UYVY, so if you're lucky then the gst-omx plugins should just work (I haven't tried that bit). It still copies the data around a few times, so it's not got all the optimisations possible in there. As noted above, the maximum data rate on 2 lanes is sufficient for 1080P50 as UYVY. In RGB888 mode 1080P30 is likely to be the maximum.
For capture there is also my fork of the yavta test app.

Code: Select all

git clone https://github.com/6by9/yavta
make
./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
should encode 100 frames (I'm not sure that counter works) to file.h264.

For audio, add

Code: Select all

dtoverlay=tc358743-audio
and wire it up as LRCK/WFS to GPIO 19, BCK/SCK to GPIO 18, and DATA/SD to GPIO 20. (those are 7, 6 and 5 respectively on the B101/B102 boards).
That should add an audio capture device. Capture sample rate must be read from V4L2. V4L2 also provides an extended control to denote whether audio is present or not. From the command line, "v4l2-ctl --list-ctrls" will print out the respective values (processing that output is not the right way of to do things! Use the proper V4L2 calls). The audio device does work correctly with GStreamer's alsasrc component.

There are also overlays for the ADV7282M and OV5647 (V1.3 Pi camera), but I won't go into those here.

I will be supporting this driver as time permits, so please do report issues. I'd suggest you start a new thread though - this one has got a little on the long side to be readable.

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri Sep 25, 2020 11:25 am

HotJollof wrote:
Fri Sep 25, 2020 2:05 am
Thank you @6by9 for the great information, it has greatly helped me on a project I have been working on where I am taking the feed from a regular camcorder and using araspberrypi4 and a google edgetpu to perform facial recognition on the video feed.

I find myself continuously having to run these three commands every time I need to run my program, and I was wondering if these could be automated in python with the os or subprocess module.

When I run them in sequence like below I get errors like "VIDIOC_QUERY_DV_TIMINGS: failed: Link has been severed"

subprocess.run(['v4l2-ctl', '--set-edid=file=1080P50EDID.txt', '--fix-edid-checksums'], capture_output=True)
subprocess.run(['v4l2-ctl', '--query-dv-timings'])
subprocess.run(['./yavta --capture=10 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0'], shell=True)

However if I only run only one like below, I get the expected results.

subprocess.run(['v4l2-ctl', '--query-dv-timings'])

Any insights into what is causing the issue?
Timing.
Setting the EDID causes the bridge chip to deassert and reassert the hotplug line to make the source (your camcorder) reread the EDID. Only once the source has reread the EDID and determined what resolution it should be in can it reconfigure and enable its HDMI output.

Unless you're changing the EDID between runs, you only need to do it once per boot. You really need to leave 1-2 seconds after setting the EDID before expecting there to be any valid input.

Note that "v4l2-ctl --query-dv-timings" only tells you what the timings are, it doesn't set them. yavta has code in that will set them, but you can also do it manually via "v4l2-ctl --set-dv-bt-timings query"
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: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed Nov 11, 2020 1:26 am

Tanner1pl wrote:
Sun Aug 18, 2019 7:28 pm
Hello, I have an issue which might be a bug - tested on both Auvidea B101/3b+ and B102/Zero with two blackmagic camers - Pocket 4K and Micro Cinema Camera. I assume hardware works good, as other video sources are captured properly.

My issue - video captured has broken colors - like way too much green and pink.
Colors are fine when I use different camera or any other video source - so B101 and B102 are fine. Also, when I connect these blackmagic cameras to TV - they works good. Also many hdmi cables tested.

Looks more like TC358743 doesn't recognize format/config of video coming from blackmagic - it sends clear 10bit 1080p@25fps 4.2.2 video which can be recorded using external recorder. Looks very similar (if not exactly) like issue with YCrCb vs RGBFull pixel formatting. Has anyone faced this issue and found solution? :)

Code: Select all

raspivid -t 5000 -w 1920 -h 1080 -fps 25 -o test.h264
Zrzut-ekranu-2019-08-18-o-21.12.59.jpg


While image coming out from camera is fine, like here on preview LCD or when I connect monitor/TV to camera.
68800270_360682631267652_8322857960573239296_n.jpg
Hi - I'm having the same "pink image" issue connecting a blackmagic micro cinema camera to a pi 3B via HDMI -> CSI-2 bridge that contains the TC358743 chip. Any success finding a way to get it to work? It seems like the problem is that the video from the blackmagic camera is 10-bit color depth and the pi only reads 8-bit data.

Any ideas on how to down convert the video signal to 8-bits in software or in hardware?

Thanks so much,
Jamie

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed Nov 11, 2020 7:46 am

jamiebasil wrote:
Wed Nov 11, 2020 1:26 am
Tanner1pl wrote:
Sun Aug 18, 2019 7:28 pm
Hello, I have an issue which might be a bug - tested on both Auvidea B101/3b+ and B102/Zero with two blackmagic camers - Pocket 4K and Micro Cinema Camera. I assume hardware works good, as other video sources are captured properly.

My issue - video captured has broken colors - like way too much green and pink.
Colors are fine when I use different camera or any other video source - so B101 and B102 are fine. Also, when I connect these blackmagic cameras to TV - they works good. Also many hdmi cables tested.

Looks more like TC358743 doesn't recognize format/config of video coming from blackmagic - it sends clear 10bit 1080p@25fps 4.2.2 video which can be recorded using external recorder. Looks very similar (if not exactly) like issue with YCrCb vs RGBFull pixel formatting. Has anyone faced this issue and found solution? :)

Code: Select all

raspivid -t 5000 -w 1920 -h 1080 -fps 25 -o test.h264
Zrzut-ekranu-2019-08-18-o-21.12.59.jpg


While image coming out from camera is fine, like here on preview LCD or when I connect monitor/TV to camera.
68800270_360682631267652_8322857960573239296_n.jpg
Hi - I'm having the same "pink image" issue connecting a blackmagic micro cinema camera to a pi 3B via HDMI -> CSI-2 bridge that contains the TC358743 chip. Any success finding a way to get it to work? It seems like the problem is that the video from the blackmagic camera is 10-bit color depth and the pi only reads 8-bit data.

Any ideas on how to down convert the video signal to 8-bits in software or in hardware?
You've quoted against a post referring to using raspivid. Any use of raspivid with a TC358743 is unsupported.
The kernel driver does have some code in there which appears to set up the colour conversion matrix sensibly, so I would have reasonable hopes that it can cope. But also double check your EDID to see whether it advertises support for YCbCr422 or not. Ideally you want it not to.

As advised on the earlier posts, a Kramer presentation switch should do the job for you.
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.

upanie
Posts: 2
Joined: Tue Nov 24, 2020 10:49 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue Nov 24, 2020 11:29 pm

Hi,

I'm trying to make B101 from Auvidea work on RPI4/4G under Ubuntu.
I tried Ubuntu 18.04 and 20.10 with the same results/problems.

Case no. 1
On fresh install of Ubuntu after enabling camera (start_x1=1 in /boot/firmware/config.txt) it sort of works.
I can run ustreamer or get the video using picamera and it works fine.
Fine means that the video content is visible and is perfectly fine :)
But I can't control the b101 module. I can't set EDID, check timings, nothing.
By default, without EDID, B101 works in 720p and the HDMI source can't see it as a HDMI "sink".
No resolution negotiation, nothing. So for most cases it's useless. But at least video works in one configuration.

Case no. 2
So following @6by9 instructions I added overlay to config.txt file and after that /dev/video0 and /dev/video1 vanished.
I found that Ubuntu doesn't come with tc358743 kernel module. So I built it and after loading it video device came back.
And now I can control the module. I can set an EDID, check and set timing, etc.
Any HDMI source can now see a valid video receiver (display), resolution negotiation works fine. Everything looks fine but...
I can't get any video from B101 module.
@6by9 I found your comment here https://github.com/raspberrypi/linux/is ... -624565359
It looks exactly like my case. Do you remember what was the cause?

After making the same steps on Raspbian everything works fine. I can control it and get the video content.
So it has nothing to do with the hardware.

At first I was trying to make it work on Ubuntu 18.04 but then I tried 20.10 with newer kernel and newer firmware but I get the same results.

Now few attachments for Ubuntu 20.10:

Code: Select all

[pi4]
max_framebuffers=2

[all]
arm_64bit=1
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel

# Enable the audio output, I2C and SPI interfaces on the GPIO header
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Enable the FKMS ("Fake" KMS) graphics overlay, enable the camera firmware
# and allocate 128Mb to the GPU memory
dtoverlay=tc358743
dtoverlay=vc4-fkms-v3d
gpu_mem=128
start_x=1

# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1

# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2

# If you have a CM4, uncomment the following line to enable the USB2 outputs
# on the IO board (assuming your CM4 is plugged into such a board)
#dtoverlay=dwc2,dr_mode=host

Code: Select all

ubuntu@ubuntu-desktop:~$ vcgencmd version
Sep  2 2020 21:14:24
Copyright (c) 2012 Broadcom
version 4439d2aaa6c376a2d1ef4402f142e1cf4de37c43 (clean) (release) (start_x)
ubuntu@ubuntu-desktop:~$ uname -a
Linux ubuntu-desktop 5.8.0-1007-raspi #10-Ubuntu SMP PREEMPT Thu Nov 5 17:52:40 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

Code: Select all

ubuntu@ubuntu-desktop:~$ lsmod
Module                  Size  Used by
rfcomm                110592  4
algif_hash             20480  1
aes_neon_bs            32768  2
aes_neon_blk           36864  3 aes_neon_bs
crypto_simd            24576  2 aes_neon_bs,aes_neon_blk
cryptd                 32768  2 crypto_simd
algif_skcipher         20480  1
af_alg                 32768  6 algif_hash,algif_skcipher
hci_uart              163840  1
btqca                  20480  1 hci_uart
btrtl                  28672  1 hci_uart
btbcm                  24576  1 hci_uart
btintel                32768  1 hci_uart
bnep                   36864  2
vc4                   294912  9
drm_kms_helper        282624  3 vc4
snd_soc_core          294912  1 vc4
snd_compress           36864  1 snd_soc_core
btsdio                 20480  0
ac97_bus               16384  1 snd_soc_core
joydev                 32768  0
snd_bcm2835            36864  2
pl2303                 28672  0
snd_pcm_dmaengine      20480  1 snd_soc_core
input_leds             16384  0
bluetooth             737280  35 btrtl,btqca,btsdio,btintel,hci_uart,btbcm,bnep,rfcomm
usbserial              65536  1 pl2303
snd_pcm_oss            69632  0
snd_mixer_oss          36864  1 snd_pcm_oss
ecdh_generic           16384  1 bluetooth
ecc                    32768  1 ecdh_generic
snd_pcm               155648  6 vc4,snd_bcm2835,snd_compress,snd_pcm_oss,snd_soc_core,snd_pcm_dmaengine
brcmfmac              434176  0
snd_seq_dummy          16384  0
snd_seq_oss            61440  0
brcmutil               28672  1 brcmfmac
tc358743               45056  1
cfg80211              921600  1 brcmfmac
cec                    77824  3 drm_kms_helper,vc4,tc358743
v3d                    90112  3
snd_seq_midi           20480  0
bcm2835_unicam         49152  0
snd_seq_midi_event     16384  2 snd_seq_midi,snd_seq_oss
gpu_sched              45056  1 v3d
v4l2_fwnode            36864  2 bcm2835_unicam,tc358743
snd_rawmidi            53248  1 snd_seq_midi
raspberrypi_hwmon      16384  0
v4l2_dv_timings        40960  2 bcm2835_unicam,tc358743
crct10dif_ce           20480  1
snd_seq               102400  6 snd_seq_midi,snd_seq_oss,snd_seq_midi_event,snd_seq_dummy
bcm2835_codec          49152  0
bcm2835_isp            36864  0
v4l2_mem2mem           49152  1 bcm2835_codec
bcm2835_v4l2           49152  0
snd_seq_device         20480  4 snd_seq,snd_seq_midi,snd_seq_oss,snd_rawmidi
bcm2835_mmal_vchiq     49152  3 bcm2835_codec,bcm2835_v4l2,bcm2835_isp
videobuf2_dma_contig    24576  3 bcm2835_codec,bcm2835_unicam,bcm2835_isp
snd_timer              49152  2 snd_seq,snd_pcm
videobuf2_vmalloc      20480  1 bcm2835_v4l2
videobuf2_memops       20480  2 videobuf2_vmalloc,videobuf2_dma_contig
videobuf2_v4l2         36864  5 bcm2835_codec,bcm2835_unicam,bcm2835_v4l2,v4l2_mem2mem,bcm2835_isp
videobuf2_common       65536  6 bcm2835_codec,videobuf2_v4l2,bcm2835_unicam,bcm2835_v4l2,v4l2_mem2mem,bcm2835_isp
snd                   131072  15 snd_seq,snd_seq_device,snd_seq_oss,snd_bcm2835,snd_timer,snd_compress,snd_pcm_oss,snd_soc_core,snd_pcm,snd_rawmidi,snd_mixer_oss
videodev              348160  9 bcm2835_codec,v4l2_fwnode,videobuf2_v4l2,bcm2835_unicam,bcm2835_v4l2,videobuf2_common,tc358743,v4l2_mem2mem,bcm2835_isp
mc                     73728  8 videodev,bcm2835_codec,videobuf2_v4l2,bcm2835_unicam,videobuf2_common,tc358743,v4l2_mem2mem,bcm2835_isp
rpivid_mem             16384  0
fb_sys_fops            20480  1 drm_kms_helper
vc_sm_cma              49152  2 bcm2835_mmal_vchiq,bcm2835_isp
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
uio_pdrv_genirq        16384  0
uio                    28672  1 uio_pdrv_genirq
sch_fq_codel           20480  7
ppdev                  24576  0
lp                     24576  0
parport                40960  2 lp,ppdev
drm                   663552  11 gpu_sched,drm_kms_helper,v3d,vc4
ip_tables              45056  0
x_tables               57344  1 ip_tables
autofs4                61440  2
btrfs                1597440  0
blake2b_generic        20480  0
xor                    20480  1 btrfs
xor_neon               16384  1 xor
hid_generic            16384  0
usbhid                 69632  0
raid6_pq              114688  1 btrfs
libcrc32c              16384  1 btrfs
dm_mirror              28672  0
dm_region_hash         28672  1 dm_mirror
dm_log                 20480  2 dm_region_hash,dm_mirror
i2c_mux_pinctrl        16384  0
i2c_mux                16384  1 i2c_mux_pinctrl
spidev                 24576  0
xhci_pci               24576  0
xhci_pci_renesas       24576  1 xhci_pci
phy_generic            20480  0

Code: Select all

ubuntu@ubuntu-desktop:~$ 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:
ubuntu@ubuntu-desktop:~$ v4l2-ctl --set-dv-bt-timings query
BT timings set
ubuntu@ubuntu-desktop:~$ 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             :
ubuntu@ubuntu-desktop:~$ v4l2-ctl -v pixelformat=UYVY
ubuntu@ubuntu-desktop:~$ v4l2-ctl --log-status

Status Log:

   [ 7577.741201] unicam fe801000.csi: =================  START STATUS  =================
   [ 7577.742861] tc358743 10-000f: -----Chip status-----
   [ 7577.743466] tc358743 10-000f: Chip ID: 0x00
   [ 7577.744071] tc358743 10-000f: Chip revision: 0x00
   [ 7577.744076] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 7577.744079] tc358743 10-000f: Sleep mode: off
   [ 7577.744083] tc358743 10-000f: Cable detected (+5V power): yes
   [ 7577.744737] tc358743 10-000f: DDC lines enabled: yes
   [ 7577.745255] tc358743 10-000f: Hotplug enabled: yes
   [ 7577.745859] tc358743 10-000f: CEC enabled: no
   [ 7577.745863] tc358743 10-000f: -----Signal status-----
   [ 7577.745866] tc358743 10-000f: TMDS signal detected: yes
   [ 7577.745869] tc358743 10-000f: Stable sync signal: yes
   [ 7577.745873] tc358743 10-000f: PHY PLL locked: yes
   [ 7577.745876] tc358743 10-000f: PHY DE detected: yes
   [ 7577.752510] tc358743 10-000f: Detected format: 1280x720p60.00 (1650x750)
   [ 7577.752516] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [ 7577.752521] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [ 7577.752524] tc358743 10-000f: pixelclock: 74250000
   [ 7577.752529] tc358743 10-000f: flags (0x0):
   [ 7577.752533] tc358743 10-000f: standards (0x0):
   [ 7577.752538] tc358743 10-000f: Configured format: 1280x720p60.00 (1650x750)
   [ 7577.752541] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [ 7577.752545] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [ 7577.752549] tc358743 10-000f: pixelclock: 74250000
   [ 7577.752553] tc358743 10-000f: flags (0x0):
   [ 7577.752556] tc358743 10-000f: standards (0x0):
   [ 7577.752559] tc358743 10-000f: -----CSI-TX status-----
   [ 7577.752564] tc358743 10-000f: Lanes needed: 1
   [ 7577.752567] tc358743 10-000f: Lanes in use: 1
   [ 7577.753172] tc358743 10-000f: Waiting for particular sync signal: no
   [ 7577.753775] tc358743 10-000f: Transmit mode: no
   [ 7577.754378] tc358743 10-000f: Receive mode: no
   [ 7577.754981] tc358743 10-000f: Stopped: no
   [ 7577.754984] tc358743 10-000f: Color space: YCbCr 422 16-bit
   [ 7577.755497] tc358743 10-000f: -----HDMI status-----
   [ 7577.755501] tc358743 10-000f: HDCP encrypted content: no
   [ 7577.755505] tc358743 10-000f: Input color space: RGB limited range
   [ 7577.756018] tc358743 10-000f: AV Mute: off
   [ 7577.756537] tc358743 10-000f: Deep color mode: 8-bits per channel
   [ 7577.759011] tc358743 10-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [ 7577.759017] tc358743 10-000f:     colorspace: RGB
   [ 7577.759022] tc358743 10-000f:     scan mode: No Data
   [ 7577.759026] tc358743 10-000f:     colorimetry: ITU709
   [ 7577.759030] tc358743 10-000f:     picture aspect: 16:9
   [ 7577.759035] tc358743 10-000f:     active aspect: Same as Picture
   [ 7577.759039] tc358743 10-000f:     itc: IT Content
   [ 7577.759043] tc358743 10-000f:     extended colorimetry: xvYCC 601
   [ 7577.759047] tc358743 10-000f:     quantization range: Limited
   [ 7577.759051] tc358743 10-000f:     nups: Unknown Non-uniform Scaling
   [ 7577.759055] tc358743 10-000f:     video code: 4
   [ 7577.759059] tc358743 10-000f:     ycc quantization range: Limited
   [ 7577.759063] tc358743 10-000f:     hdmi content type: Graphics
   [ 7577.759068] tc358743 10-000f:     pixel repeat: 0
   [ 7577.759072] tc358743 10-000f:     bar top 0, bottom 0, left 0, right 0
   [ 7577.759077] unicam fe801000.csi: -----Receiver status-----
   [ 7577.759080] unicam fe801000.csi: V4L2 width/height:   1280x720
   [ 7577.759084] unicam fe801000.csi: Mediabus format:     0000200f
   [ 7577.759088] unicam fe801000.csi: V4L2 format:         59565955
   [ 7577.759092] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 7577.759095] unicam fe801000.csi: ----Live data----
   [ 7577.759099] unicam fe801000.csi: Programmed stride:      0
   [ 7577.759102] unicam fe801000.csi: Detected resolution: 0x0
   [ 7577.759106] unicam fe801000.csi: Write pointer:       00000000
   [ 7577.759110] unicam fe801000.csi: ==================  END STATUS  ==================

Code: Select all

ubuntu@ubuntu-desktop:~$ vcgencmd get_camera
supported=1 detected=0
ubuntu@ubuntu-desktop:~$ raspistill -o picure.jpg
mmal: Cannot read camera info, keeping the defaults for OV5647
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly
I tried even change firmware by hand but it then the OS didn't even boot :D

Anyone any idea?
And again please don't suggest hardware issue because on Raspbian it works perfectly fine.

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed Nov 25, 2020 1:40 pm

upanie wrote:
Tue Nov 24, 2020 11:29 pm
I'm trying to make B101 from Auvidea work on RPI4/4G under Ubuntu.
I tried Ubuntu 18.04 and 20.10 with the same results/problems.

Case no. 1
On fresh install of Ubuntu after enabling camera (start_x1=1 in /boot/firmware/config.txt) it sort of works.
I can run ustreamer or get the video using picamera and it works fine.
Fine means that the video content is visible and is perfectly fine :)
But I can't control the b101 module. I can't set EDID, check timings, nothing.
By default, without EDID, B101 works in 720p and the HDMI source can't see it as a HDMI "sink".
No resolution negotiation, nothing. So for most cases it's useless. But at least video works in one configuration.
All use of raspivid/still/Picamera with a tc358743 device is unsupported.
upanie wrote:Case no. 2
So following @6by9 instructions I added overlay to config.txt file and after that /dev/video0 and /dev/video1 vanished.
I found that Ubuntu doesn't come with tc358743 kernel module. So I built it and after loading it video device came back.
And now I can control the module. I can set an EDID, check and set timing, etc.
Any HDMI source can now see a valid video receiver (display), resolution negotiation works fine. Everything looks fine but...
I can't get any video from B101 module.
@6by9 I found your comment here https://github.com/raspberrypi/linux/is ... -624565359
It looks exactly like my case. Do you remember what was the cause?
My problem was a dead board or possibly part broken FFC from board to Pi.
What commands have you used to determine that your B101 is dead?
upanie wrote:After making the same steps on Raspbian everything works fine. I can control it and get the video content.
So it has nothing to do with the hardware.

At first I was trying to make it work on Ubuntu 18.04 but then I tried 20.10 with newer kernel and newer firmware but I get the same results.
<snip>

Code: Select all

ubuntu@ubuntu-desktop:~$ 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:
ubuntu@ubuntu-desktop:~$ v4l2-ctl --set-dv-bt-timings query
BT timings set
ubuntu@ubuntu-desktop:~$ 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             :
ubuntu@ubuntu-desktop:~$ v4l2-ctl -v pixelformat=UYVY
ubuntu@ubuntu-desktop:~$ v4l2-ctl --log-status

Status Log:

   [ 7577.741201] unicam fe801000.csi: =================  START STATUS  =================
   [ 7577.742861] tc358743 10-000f: -----Chip status-----
   [ 7577.743466] tc358743 10-000f: Chip ID: 0x00
   [ 7577.744071] tc358743 10-000f: Chip revision: 0x00
   [ 7577.744076] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 7577.744079] tc358743 10-000f: Sleep mode: off
   [ 7577.744083] tc358743 10-000f: Cable detected (+5V power): yes
   [ 7577.744737] tc358743 10-000f: DDC lines enabled: yes
   [ 7577.745255] tc358743 10-000f: Hotplug enabled: yes
   [ 7577.745859] tc358743 10-000f: CEC enabled: no
   [ 7577.745863] tc358743 10-000f: -----Signal status-----
   [ 7577.745866] tc358743 10-000f: TMDS signal detected: yes
   [ 7577.745869] tc358743 10-000f: Stable sync signal: yes
   [ 7577.745873] tc358743 10-000f: PHY PLL locked: yes
   [ 7577.745876] tc358743 10-000f: PHY DE detected: yes
   [ 7577.752510] tc358743 10-000f: Detected format: 1280x720p60.00 (1650x750)
   [ 7577.752516] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [ 7577.752521] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [ 7577.752524] tc358743 10-000f: pixelclock: 74250000
   [ 7577.752529] tc358743 10-000f: flags (0x0):
   [ 7577.752533] tc358743 10-000f: standards (0x0):
   [ 7577.752538] tc358743 10-000f: Configured format: 1280x720p60.00 (1650x750)
   [ 7577.752541] tc358743 10-000f: horizontal: fp = 0, -sync = 370, bp = 0
   [ 7577.752545] tc358743 10-000f: vertical: fp = 0, -sync = 30, bp = 0
   [ 7577.752549] tc358743 10-000f: pixelclock: 74250000
   [ 7577.752553] tc358743 10-000f: flags (0x0):
   [ 7577.752556] tc358743 10-000f: standards (0x0):
   [ 7577.752559] tc358743 10-000f: -----CSI-TX status-----
   [ 7577.752564] tc358743 10-000f: Lanes needed: 1
   [ 7577.752567] tc358743 10-000f: Lanes in use: 1
   [ 7577.753172] tc358743 10-000f: Waiting for particular sync signal: no
   [ 7577.753775] tc358743 10-000f: Transmit mode: no
   [ 7577.754378] tc358743 10-000f: Receive mode: no
   [ 7577.754981] tc358743 10-000f: Stopped: no
   [ 7577.754984] tc358743 10-000f: Color space: YCbCr 422 16-bit
   [ 7577.755497] tc358743 10-000f: -----HDMI status-----
   [ 7577.755501] tc358743 10-000f: HDCP encrypted content: no
   [ 7577.755505] tc358743 10-000f: Input color space: RGB limited range
   [ 7577.756018] tc358743 10-000f: AV Mute: off
   [ 7577.756537] tc358743 10-000f: Deep color mode: 8-bits per channel
   [ 7577.759011] tc358743 10-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [ 7577.759017] tc358743 10-000f:     colorspace: RGB
   [ 7577.759022] tc358743 10-000f:     scan mode: No Data
   [ 7577.759026] tc358743 10-000f:     colorimetry: ITU709
   [ 7577.759030] tc358743 10-000f:     picture aspect: 16:9
   [ 7577.759035] tc358743 10-000f:     active aspect: Same as Picture
   [ 7577.759039] tc358743 10-000f:     itc: IT Content
   [ 7577.759043] tc358743 10-000f:     extended colorimetry: xvYCC 601
   [ 7577.759047] tc358743 10-000f:     quantization range: Limited
   [ 7577.759051] tc358743 10-000f:     nups: Unknown Non-uniform Scaling
   [ 7577.759055] tc358743 10-000f:     video code: 4
   [ 7577.759059] tc358743 10-000f:     ycc quantization range: Limited
   [ 7577.759063] tc358743 10-000f:     hdmi content type: Graphics
   [ 7577.759068] tc358743 10-000f:     pixel repeat: 0
   [ 7577.759072] tc358743 10-000f:     bar top 0, bottom 0, left 0, right 0
   [ 7577.759077] unicam fe801000.csi: -----Receiver status-----
   [ 7577.759080] unicam fe801000.csi: V4L2 width/height:   1280x720
   [ 7577.759084] unicam fe801000.csi: Mediabus format:     0000200f
   [ 7577.759088] unicam fe801000.csi: V4L2 format:         59565955
   [ 7577.759092] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 7577.759095] unicam fe801000.csi: ----Live data----
   [ 7577.759099] unicam fe801000.csi: Programmed stride:      0
   [ 7577.759102] unicam fe801000.csi: Detected resolution: 0x0
   [ 7577.759106] unicam fe801000.csi: Write pointer:       00000000
   [ 7577.759110] unicam fe801000.csi: ==================  END STATUS  ==================
That all looks fine for setting stuff up, but what command have you used to request the device to stream?
upanie wrote:

Code: Select all

ubuntu@ubuntu-desktop:~$ vcgencmd get_camera
supported=1 detected=0
ubuntu@ubuntu-desktop:~$ raspistill -o picure.jpg
mmal: Cannot read camera info, keeping the defaults for OV5647
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly
"vcgencmd get_camera" is irrelevant when using the kernel drivers.
raspistill is unsupported with the firmware drivers, and irrelevant with the kernel drivers. DON'T USE 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.

upanie
Posts: 2
Joined: Tue Nov 24, 2020 10:49 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed Nov 25, 2020 10:09 pm

6by9 wrote: What commands have you used to determine that your B101 is dead?
My board isn't dead for sure. It works fine in Raspbian.
6by9 wrote: That all looks fine for setting stuff up, but what command have you used to request the device to stream?
1. my custom software based on picamera - but since you said it won't work then let's forget about it.
2. gstreamer

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
.
3. ustreamer: https://github.com/pikvm/ustreamer

Code: Select all

./ustreamer --format=uyvy --encoder=HW --workers=3 --persistent --dv-timings --drop-same-frames=30 --host=0.0.0.0
Ubuntu:
1. works when tc358734 not used. If used, then you know... unsupported :)
2. when tc358734 used it produces empty file (size: 0 bytes)
3. works when tc358734 not used. If used then it can't read video stream.

Raspbian:
1. didn't check
2. gstreamer doesn't work:

Code: Select all

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
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.095694562
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
3. ustreamer works fine when tc358734 is used.

I din't check what happens without tc358734 driver in Raspbian but since it works with the driver then I don't need to check that.

So to sum up: in Ubuntu nothing works, in Raspbian ustreamer works fine.
But I really need Ubuntu :(

Return to “Graphics, sound and multimedia”