6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7329
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

Mon Aug 19, 2019 9:17 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
As per the message that comes up whenever you run raspivid with a B101 connected.
The driver for the TC358743 HDMI to CSI2 chip you are using is NOT supported.
They were written for a demo purposes only, and are in the firmware on an as-is
basis and therefore requests for support or changes will not be acted on.
The Linux kernel drivers for this board are the only supported configuration.

AFAIK 10bit YUV is not supported by the chip on the board, therefore there is unlikely to be a solution. The cameras should read the EDID provided by the board (or user) and select an output format that is supported by the HDMI sink. If it is selecting a 10bit format then either the EDID is wrong, or it's not parsing it correctly.
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: 7329
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

Mon Aug 19, 2019 9:19 am

manmathan74 wrote:
Mon Aug 19, 2019 6:56 am
Hi All,
Can someone help? I am trying to get the B101 v4 board to work on Pi 3b+ but am lost with so many point on this forum. Is there a step by step on this board?

Thanks,
https://www.raspberrypi.org/forums/view ... 8#p1339178
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.

Tanner1pl
Posts: 3
Joined: Sun Aug 18, 2019 7:08 pm

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

Mon Aug 19, 2019 10:08 am

6by9 wrote:
Mon Aug 19, 2019 9:17 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
As per the message that comes up whenever you run raspivid with a B101 connected.
The driver for the TC358743 HDMI to CSI2 chip you are using is NOT supported.
They were written for a demo purposes only, and are in the firmware on an as-is
basis and therefore requests for support or changes will not be acted on.
The Linux kernel drivers for this board are the only supported configuration.

AFAIK 10bit YUV is not supported by the chip on the board, therefore there is unlikely to be a solution. The cameras should read the EDID provided by the board (or user) and select an output format that is supported by the HDMI sink. If it is selecting a 10bit format then either the EDID is wrong, or it's not parsing it correctly.


Thank you for your answer. Actually I didn't provide any custom EDID in configuration, so board is sending something default to camera. But here is tricky part, I am pretty sure these blackmagic's hdmi output is fixed, as it can be used for external recorder, they don't provide anything else than 10bit 1080p @ fps same as shooting. And yeah, these cameras don't work with few cheap/old screens, that would make sense.

What I am thinking now, maybe some middle-device would help, like hdmi downscaller or something that could read video from blackmagic and output it in less strict format.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7329
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

Mon Aug 19, 2019 10:49 am

Tanner1pl wrote:
Mon Aug 19, 2019 10:08 am
Thank you for your answer. Actually I didn't provide any custom EDID in configuration, so board is sending something default to camera. But here is tricky part, I am pretty sure these blackmagic's hdmi output is fixed, as it can be used for external recorder, they don't provide anything else than 10bit 1080p @ fps same as shooting. And yeah, these cameras don't work with few cheap/old screens, that would make sense.

What I am thinking now, maybe some middle-device would help, like hdmi downscaller or something that could read video from blackmagic and output it in less strict format.
Something will always be providing an EDID. In your case it will be the firmware (using the unsupported driver).
Ignoring the EDID is a tad annoying, but nothing much that can be done about it.

I suspect one of the Kramer switchers will do the appropriate down conversion for you. They don't come cheap though (unless you're buying older ones off Ebay as I have been).
There is an updated version of the TC358743 chip that does support up to 4k30 - the TC358840. I haven't seen any discussion of drivers for it, nor boards that use it, and it potentially has some very odd formatting of the data across two CSI2 interfaces. The product brief doesn't list 10bit support either, so it may not be supported even there.
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.

Tanner1pl
Posts: 3
Joined: Sun Aug 18, 2019 7:08 pm

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

Thu Aug 22, 2019 12:24 pm

6by9 wrote:
Mon Aug 19, 2019 10:49 am
Something will always be providing an EDID. In your case it will be the firmware (using the unsupported driver).
Ignoring the EDID is a tad annoying, but nothing much that can be done about it.

I suspect one of the Kramer switchers will do the appropriate down conversion for you. They don't come cheap though (unless you're buying older ones off Ebay as I have been).
There is an updated version of the TC358743 chip that does support up to 4k30 - the TC358840. I haven't seen any discussion of drivers for it, nor boards that use it, and it potentially has some very odd formatting of the data across two CSI2 interfaces. The product brief doesn't list 10bit support either, so it may not be supported even there.

Thank you, very appreciated. I've got response from Auvidea, they confirmed as below. So now, last thing that could work (before converter) would be use prepared EEID and only if blackmagic camera could switch to 8bit output, then I would be fine.
we are not exactly sure what the problem could be since we’ve never performed any tests with Blackmagic cameras, but our best guess would be that 10bit color depth is not supported on our chip, so if you could change the output somehow to 8bit, maybe that would fix it then.

edudelosan
Posts: 1
Joined: Tue Oct 22, 2019 5:57 am

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

Tue Oct 22, 2019 6:04 am

Hello good mornig for everyone. I need some help.
I have an HDMI to CSI board with the TC358743 chip.
I read the forum but there are some things I did not understand. Someone can guide me in the steps to follow.
I just want to visualize video from a camera. No audio required I don't know if I have to connect something to the GIPO.
Thank you.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7329
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

Tue Oct 22, 2019 8:59 am

edudelosan wrote:
Tue Oct 22, 2019 6:04 am
Hello good mornig for everyone. I need some help.
I have an HDMI to CSI board with the TC358743 chip.
I read the forum but there are some things I did not understand. Someone can guide me in the steps to follow.
I just want to visualize video from a camera. No audio required I don't know if I have to connect something to the GIPO.
Thank you.
Please read https://www.raspberrypi.org/forums/view ... 8#p1339178
The one update is that you can use

Code: Select all

v4l2-ctl --set-dv-bt-timings query
to read the current timings and set them.
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.

cr1cr1
Posts: 3
Joined: Tue Oct 22, 2019 11:14 am

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

Tue Oct 22, 2019 11:20 am

This was submitted by mistake, see the next post please :)
Last edited by cr1cr1 on Tue Oct 22, 2019 11:49 am, edited 1 time in total.

cr1cr1
Posts: 3
Joined: Tue Oct 22, 2019 11:14 am

Unable to request buffers: Cannot allocate memory (12)

Tue Oct 22, 2019 11:48 am

Hello,

TL;DR: Getting "Unable to request buffers: Cannot allocate memory (12)." when running yavta or fswebcam

========================================================================

Ran:

Code: Select all

root@pi3:~# v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums

CEA-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

CEA-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

Code: Select all

root@pi3:~# v4l2-ctl --set-dv-bt-timings query --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_QUERY_DV_TIMINGS: ok
        Active width: 1920
        Active height: 1080
        Total width: 2200
        Total height: 1125
        Frame format: progressive
        Polarities: -vsync -hsync
        Pixelclock: 148500000 Hz (60.00 frames per second)
        Horizontal frontporch: 0
        Horizontal sync: 280
        Horizontal backporch: 0
        Vertical frontporch: 0
        Vertical sync: 45
        Vertical backporch: 0
        Standards:
        Flags:
VIDIOC_S_DV_TIMINGS: ok
BT timings set

Code: Select all

root@pi3:~# ./yavta/yavta --capture=60 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
We're encoding to file.h264
Device /dev/video0 opened.
Device `unicam' on `platform:unicam 3f801000.csi' (driver 'unicam') is a video capture (without mplanes) device.
stride is 0
stride is now 1280
Video format set: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
Framerate is 60
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
vc.ril.isp:in:0(UYVY)(0x15b9fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 1920, height: 1088, (0,0,1920,1080) pixel aspect ratio: 0/0, frame rate: 0/0
buffers num: 3(opt 1, min 1), size: 4177920(opt 4177920, min: 4177920), align: 0
Created pool of length 3, size 0
Enable encoder....
Create pool of 3 buffers of size 0 for render
Create pool of 3 buffers of size 0 for encode ip
Create pool of 3 buffers of size 3133440 for encode/render
Writing data to file.h264
Create pool of 8 buffers of size 262144
Sent buffer 0x15c3d58
Sent buffer 0x15c3f30
Sent buffer 0x15c4108
Sent buffer 0x15c42e0
Sent buffer 0x15c44b8
Sent buffer 0x15c4690
Sent buffer 0x15c4868
Sent buffer 0x15c4a40
Unable to request buffers: Cannot allocate memory (12).
========================================================================

System information:

Code: Select all

root@pi3:~# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.11 (stretch)
Release:        9.11
Codename:       stretch

Code: Select all

root@pi3:~# grep '^[^#]' /boot/config.txt
dtparam=spi=on
dtparam=audio=on
start_x=1
gpu_mem=128
dtoverlay=tc358743
cma=96M

Code: Select all

root@pi3:~# vcgencmd version
Oct 21 2019 16:52:13
Copyright (c) 2012 Broadcom
version 509fb1bcb9511d963439429724a6f6dfb8251107 (tainted) (release) (start_x)

Code: Select all

root@pi3:~# uname -a
Linux pi3 4.19.80-v7+ #1274 SMP Mon Oct 21 16:23:10 BST 2019 armv7l GNU/Linux

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  ==================
========================================================================

Hardware:

- Raspberry PI:

Code: Select all

Hardware        : BCM2835
Revision        : a020d3
Serial          : 00000000a4f720f8
Model           : Raspberry Pi 3 Model B Plus Rev 1.3
- Capture board: Lusya Upgraded version Raspberry Pi HDMI Adapter Board HDMI interface to CSI-2 TC358743XBG for 3B 3B+ ZERO G11-011 (https://www.aliexpress.com/item/4000152180240.html)

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

Re: Unable to request buffers: Cannot allocate memory (12)

Tue Oct 22, 2019 12:11 pm

cr1cr1 wrote:
Tue Oct 22, 2019 11:48 am

Code: Select all

root@pi3:~# grep '^[^#]' /boot/config.txt
dtparam=spi=on
dtparam=audio=on
start_x=1
gpu_mem=128
dtoverlay=tc358743
cma=96M
cma=96M goes in /boot/cmdline.txt (with no added carriage returns), not in config.txt.
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.

cr1cr1
Posts: 3
Joined: Tue Oct 22, 2019 11:14 am

Re: Unable to request buffers: Cannot allocate memory (12)

Tue Oct 22, 2019 9:51 pm

That's right, sorry to have missed the trivial thing - after reading for a long time the many posts here it became a bit harder to keep up with all the details.

Running ./yavta/yavta --capture=300 -n 4 --encode-to=/tmp/file.mp4 -f UYVY -m -T /dev/video0 now works.

I have tried directly connecting a source (like a laptop) and works with the "native" resolution of 1280x720 - which is great for my purpose of running Hyperion to control some LEDs based on the video input.

Reading previous posts in this thread related to Hyperion, I have managed to take snapshots and start the service (after removing PAL/NTSC format spec):

Code: Select all

hyperion-v4l2 --device /dev/video0 --input 0 --width -1 --height -1 --size-decimator 1 --frame-decimator 2 --red-threshold 0.0 --green-threshold 0.0 --blue-threshold 0.0 --screenshot
It is amazing the difference of the clean picture coming from the HDMI capture board compared to the old solution of having a converter to analog video and capture it back to Raspberry Pi. Clean picture translates into LEDs turned off completely and no flickering, great black borders detection and more.


However, records only black frames or the image is broken when I use a splitter. Seems to be interlaced, but I am not sure.
This device is downscaling 4k@60Hz to a stubborn 1080p@60Hz. Is needed for obvious reason: have the HDMI video stream to the TV and also to the capture board and Raspberry to be used by Hyperion that controls the LEDs on the back of the TV.

Image

If I will manage to fix the above problem, eventually, will use udev rules to:

Code: Select all

- v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums
- v4l2-ctl --set-dv-bt-timings query
- v4l2-ctl -v pixelformat=UYVY
to automate changes in the device, I imagine will be triggered when HDMI is connected, etc.

All this is quite new to me, so there is more to dig up.

Thanks 6by9 for the great work and explanations, and the patience you have showed in all these posts.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7329
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 Oct 23, 2019 8:52 am

Most cheap splitters I've encountered will amend the edid to advertise the subset of modes supported by both displays. None of them support scaling.

1080p60 exceeds the bandwidth available over 2 csi2 lanes, so won't work on a standard Pi, only the compute module. The driver should complain on that and not allow streaming to start. Confirm what mode the bridge is actually detecting via "v4l2-ctl - - query-detected-timings" (from memory - may have a typo).
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.

Return to “Graphics, sound and multimedia”