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

Sat Dec 07, 2019 12:12 pm

ellisium wrote:
Sat Dec 07, 2019 12:01 pm
After few searchs, I checked /dev folder and surprising no /dev/cec0 listed. Driver is not CEC enable by default?

Code: Select all

[email protected]:~ $ sudo modprobe configs
[email protected]:~ $ zcat /proc/config.gz | grep TC358743
CONFIG_VIDEO_TC358743=m
# CONFIG_VIDEO_TC358743_CEC is not set
So no, the CEC side of the TC358743 driver is not loaded by default. You'll need to build your own kernel for now to try it out.
If it works, then create an issue under https://github.com/raspberrypi/linux/issues to request that it is added to the default configurations.
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.

ellisium
Posts: 11
Joined: Sat Nov 23, 2019 8:29 pm

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

Sat Dec 07, 2019 1:44 pm

Thank you to confirm it
I never had to build kernel by myself. I'm gonna try to do it. Hope to not break my system :lol:
Do you think I can follow this step by step? https://gist.github.com/maditnerd/01195 ... 1682f1727b
Thx very much for your advice and support

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

Sat Dec 07, 2019 2:12 pm

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.

ellisium
Posts: 11
Joined: Sat Nov 23, 2019 8:29 pm

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

Sun Dec 08, 2019 10:18 am

I compiled it and now I get /dev/cec0. First test result:
Not sure about this "Logical Address : Not Allocated"

Code: Select all

sudo cec-ctl -d /dev/cec0 --no-rc-passthrough --tv -S -T -M
		CEC_ADAP_G_CAPS returned 0 (Success)
Driver Info:
	Driver Name                : tc358743
	Adapter Name               : 0-000f
	Capabilities               : 0x0000003e
		Logical Addresses
		Transmit
		Passthrough
		Remote Control Support
		Monitor All
	Driver version             : 4.19.86
	Available Logical Addresses: 4
		CEC_ADAP_G_PHYS_ADDR returned 0 (Success)
	Physical Address           : 0.0.0.0
		CEC_ADAP_S_LOG_ADDRS returned 0 (Success)
		CEC_ADAP_S_LOG_ADDRS returned 0 (Success)
		CEC_ADAP_G_LOG_ADDRS returned 0 (Success)
	Logical Address Mask       : 0x0000
	CEC Version                : 2.0
	Vendor ID                  : 0x000c03 (HDMI)
	OSD Name                   : 'TV'
	Logical Addresses          : 1 

	  Logical Address          : Not Allocated
	    Primary Device Type    : TV
	    Logical Address Type   : TV
	    All Device Types       : TV
	    RC TV Profile          : None
	    Device Features        :
		None

		CEC_ADAP_G_LOG_ADDRS returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)
		CEC_TRANSMIT returned -1 (Machine is not on the network)

		CEC_S_MODE returned 0 (Success)
		CEC_DQEVENT returned 0 (Success)

Event: State Change: PA: 0.0.0.0, LA mask: 0x0000
issue : CEC_TRANSMIT returned -1 (Machine is not on the network)
I guess I have to configure something

ellisium
Posts: 11
Joined: Sat Nov 23, 2019 8:29 pm

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

Sun Dec 08, 2019 11:01 am

I confirm issue was about logical address due to my splitter.

Code: Select all

sudo cec-ctl -d /dev/cec0 --no-rc-passthrough --tv -S -T -m
		CEC_ADAP_G_CAPS returned 0 (Success)
Driver Info:
	Driver Name                : tc358743
	Adapter Name               : 0-000f
	Capabilities               : 0x0000003e
		Logical Addresses
		Transmit
		Passthrough
		Remote Control Support
		Monitor All
	Driver version             : 4.19.86
	Available Logical Addresses: 4
		CEC_ADAP_G_PHYS_ADDR returned 0 (Success)
	Physical Address           : 0.0.0.0
		CEC_ADAP_S_LOG_ADDRS returned 0 (Success)
		CEC_ADAP_S_LOG_ADDRS returned 0 (Success)
		CEC_ADAP_G_LOG_ADDRS returned 0 (Success)
	Logical Address Mask       : 0x0001
	CEC Version                : 2.0
	Vendor ID                  : 0x000c03 (HDMI)
	OSD Name                   : 'TV'
	Logical Addresses          : 1 

	  Logical Address          : 0 (TV)
	    Primary Device Type    : TV
	    Logical Address Type   : TV
	    All Device Types       : TV
	    RC TV Profile          : None
	    Device Features        :
		None

		CEC_ADAP_G_LOG_ADDRS returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
	System Information for device 4 (Playback Device 1) from device 0 (TV):
		CEC_TRANSMIT returned 0 (Success)
		CEC Version                : 1.4
		CEC_TRANSMIT returned 0 (Success)
		Physical Address           : 3.0.0.0
		Primary Device Type        : Playback
		CEC_TRANSMIT returned 0 (Success)
		Vendor ID                  : 0x000000
		CEC_TRANSMIT returned 0 (Success)
		OSD Name                   : MIBOX4
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		Power Status               : Standby
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)
		CEC_TRANSMIT returned 0 (Success)

	Topology:

	0.0.0.0: TV
	    3.0.0.0: Playback Device 1

		CEC_S_MODE returned 0 (Success)
		CEC_DQEVENT returned 0 (Success)

Event: State Change: PA: 0.0.0.0, LA mask: 0x0001
		CEC_RECEIVE returned 0 (Success)
Received from Playback Device 1 to TV (4 to 0): CEC_MSG_GET_MENU_LANGUAGE (0x91)
		CEC_RECEIVE returned 0 (Success)
Transmitted by TV to Playback Device 1 (0 to 4): CEC_MSG_FEATURE_ABORT (0x00):
	abort-msg: 145 (0x91)
	reason: unrecognized-op (0x00)
^C

So CEC is working as expected in my case.

ellisium
Posts: 11
Joined: Sat Nov 23, 2019 8:29 pm

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

Sun Dec 08, 2019 5:46 pm

Feedback about my tests today.

I tried 2 differents splitters but I got issues with both. After checking, it doesnt support CEC... that's why. So be carefull if you want to use CEC through splitters. CEC is not a standard on splitters.

Connecting mi box directly and CEC is working as expected and got surprise about hdcp stripping. So if your home theater has 2 hdmi output you can avoid to buy a splitter.

So I connected it to my pioneer sc-lx77 on hdmi out 1 and CEC working as expected. However I can't get hdmi out 1&2 display. So I tried yavta capture and it didn't work

Code: Select all

./yavta --capture=10000 -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) 640x480 (stride 1280) field none buffer size 614400
Video format: UYVY (59565955) 640x480 (stride 1280) field none buffer size 614400
Unable to get frame rate: Inappropriate ioctl for device (25).
vc.ril.isp:in:0(UYVY)(0xbf5fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 640, height: 480, (0,0,640,480) pixel aspect ratio: 0/0, frame rate: 0/0
buffers num: 3(opt 1, min 1), size: 614400(opt 614400, min: 614400), 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 460800 for encode/render
Writing data to file.h264
Create pool of 8 buffers of size 262144
Sent buffer 0xbffd58
Sent buffer 0xbfff30
Sent buffer 0xc00108
Sent buffer 0xc002e0
Sent buffer 0xc004b8
Sent buffer 0xc00690
Sent buffer 0xc00868
Sent buffer 0xc00a40
3 buffers requested, V4L2 returned 3 bufs.
length: 614400 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x7236a000.
Importing DMABUF 8 into VCSM...
...done. vcsm_handle 73728
Exported buffer 0 to dmabuf 8, vcsm handle 73728
Linking V4L2 buffer index 0 ptr 0xc01760 to MMAL header 0xbfc4c0. mmal->data 0xC0000003
length: 614400 offset: 614400 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x722d4000.
Importing DMABUF 9 into VCSM...
...done. vcsm_handle 77824
Exported buffer 1 to dmabuf 9, vcsm handle 77824
Linking V4L2 buffer index 1 ptr 0xc017d0 to MMAL header 0xbfc698. mmal->data 0xC0000004
length: 614400 offset: 1228800 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x7223e000.
Importing DMABUF 10 into VCSM...
...done. vcsm_handle 81920
Exported buffer 2 to dmabuf 10, vcsm handle 81920
Linking V4L2 buffer index 2 ptr 0xc01840 to MMAL header 0xbfc870. mmal->data 0xC0000005
select timeout
I tried with kodi raspberry source and mi box, both set [email protected] on tv display information. Do you think it's relative to EDID?

ellisium
Posts: 11
Joined: Sat Nov 23, 2019 8:29 pm

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

Sat Dec 14, 2019 10:48 am

Previous message was my bad, I didn't stop hyperion instance. I disable all video conversion on pioneer amp too
So new clean try today and I get blackscreen "no signal" on TV when I plug amp hdmi out 2 on this board. Run the yavta command :

Code: Select all


 We're encoding to file.h264
Unmapped all buffers
> Device /dev/video0 opened.
> Device `unicam' on `platform:unicam 3f801000.csi' (driver 'unicam') is a video c                                                     apture (without mplanes) device.
> stride is 0
> stride is now 1280
> Video format set: UYVY (59565955) 640x480 (stride 1280) field none buffer size 6                                                     14400
> Video format: UYVY (59565955) 640x480 (stride 1280) field none buffer size 61440                                                     0
> Unable to get frame rate: Inappropriate ioctl for device (25).
> vc.ril.isp:in:0(UYVY)(0x1016fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0                                                      extra data: 0, (nil) width: 640, height: 480, (0,0,640,480) pixel aspect ratio:                                                      0/0, frame rate: 0/0
> buffers num: 3(opt 1, min 1), size: 614400(opt 614400, min: 614400), 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 460800 for encode/render
> Writing data to file.h264
> Create pool of 8 buffers of size 262144
> Sent buffer 0x1020d58
> Sent buffer 0x1020f30
> Sent buffer 0x1021108
> Sent buffer 0x10212e0
> Sent buffer 0x10214b8
> Sent buffer 0x1021690
> Sent buffer 0x1021868
> Sent buffer 0x1021a40
> 3 buffers requested, V4L2 returned 3 bufs.
> length: 614400 offset: 0 timestamp type/source: mono/EoF
> Buffer 0/0 mapped at address 0x7236a000.
> Importing DMABUF 8 into VCSM...
> ...done. vcsm_handle 73728
> Exported buffer 0 to dmabuf 8, vcsm handle 73728
> Linking V4L2 buffer index 0 ptr 0x1022760 to MMAL header 0x101d4c0. mmal->data 0                                                     xC0000003
> length: 614400 offset: 614400 timestamp type/source: mono/EoF
> Buffer 1/0 mapped at address 0x722d4000.
> Importing DMABUF 9 into VCSM...
> ...done. vcsm_handle 77824
> Exported buffer 1 to dmabuf 9, vcsm handle 77824
> Linking V4L2 buffer index 1 ptr 0x10227d0 to MMAL header 0x101d698. mmal->data 0                                                     xC0000004
> length: 614400 offset: 1228800 timestamp type/source: mono/EoF
> Buffer 2/0 mapped at address 0x7223e000.
> Importing DMABUF 10 into VCSM...
> ...done. vcsm_handle 81920
> Exported buffer 2 to dmabuf 10, vcsm handle 81920
> Linking V4L2 buffer index 2 ptr 0x1022840 to MMAL header 0x101d870. mmal->data 0                                                     xC0000005
> 0 (0) [-] none 0 614400 B 432.952524 432.962821 20.449 fps ts mono/EoF
> 1 (1) [-] none 1 614400 B 432.962800 432.982819 97.314 fps ts mono/EoF
> 2 (2) [-] none 2 614400 B 432.982800 433.002823 50.000 fps ts mono/EoF
> 3 (0) [-] none 3 614400 B 433.002800 433.022816 50.000 fps ts mono/EoF
> 4 (1) [-] none 4 614400 B 433.022800 433.042820 50.000 fps ts mono/EoF
> 5 (2) [-] none 5 614400 B 433.042800 433.062816 50.000 fps ts mono/EoF
> 6 (0) [-] none 6 614400 B 433.062799 433.072513 50.003 fps ts mono/EoF
> Exception
> Source changed
> QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
> Failed to set DV timings
> Unmapped all buffers
> Source changed
> Unmapped all buffers
> Source changed
> QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
> Failed to set DV timings
> Unmapped all buffers
> Source changed
> Unmapped all buffers
> Source changed
> QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
> Failed to set DV timings
> Unmapped all buffers
> Source changed
> Unmapped all buffers
> Source changed
> QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
> Failed to set DV timings
> Unmapped all buffers
> Source changed
> Unmapped all buffers
> Source changed
>

I tried " v4l2-ctl --set-dv-bt-timings" , result:

Code: Select all

VIDIOC_QUERY_DV_TIMINGS: failed: Numerical result out of range
VIDIOC_S_DV_TIMINGS: failed: Numerical result out of range
Any idea?

thx for support

proff
Posts: 1
Joined: Fri Dec 27, 2019 10:20 am

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

Fri Dec 27, 2019 10:30 am

hi every one
I just receive 2 B101 bridges
and I tested one on a RPI 4 with last raspian buster release
and it work great no color issue or images default
the only issue I have is that compared to genuine CSI2 pi cam it adds more than 3 seconds delay !!!
I'm streaming it with gstreamer to display it on a drone ground control software (QGROUND CONTROL)

Code: Select all

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! h264parse ! rtph264pay ! udpsink host=192.168.2.1 port=5000
again it's working perfectly with standard pi camera
I've try with differents hdmi sources in 180P25 and in 720p60
and it's working every time except that more that 3 sec delay is huge !!

tomcy21
Posts: 3
Joined: Wed Jan 22, 2020 1:22 pm

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

Wed Jan 22, 2020 2:03 pm

Hi everyone, and especially @6by9
Thanks for all the information in this thread. I having hard time to understand everything and take good conclusion about my problem.

I'm trying to stream in h264 using gstreamer the video of a camera linked to my Raspi 3B+ (stretch) by the module B101 using the chip TC358743 ... as a lot of people here.

I did test with 3 cameras :
- gopro4
- EAGLE EYE-30IE-360 30X EO/IR DUAL SENSOR DRONE ZOOM CAMERA
- Flir Duo Pro

Firstly, i tested with raspivid just to display the video received by the Raspi from the B101 : i got perfect video from the gopro, but only black and white strips from the 2 other cameras.
All of that with the well know warning (but warning only ! ) :

Code: Select all

 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.
I got exactly the same result by streaming the video using gstreamer and v4l2src in RTP. (but with high latency for the goPro).

So i came here to understand my problem and make it work for the 2 others cameras.

i added dtoverlay=tc358743 in /boot/config.txt , added cma=32M, did rpi-update. I did provide EDID file with

Code: Select all

v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums 
i used v4l2-ctl --query-dv-timings to set the timing.

and tried again gstreamer command. However it seems that i can't read h264 from v4l2src, but onyl raw video. Using omxh264enc, the streaming seems to be launch correctly, but i can't get anything from the RTP client.
I tried to use your yavta module : but i got error

Code: Select all

 Unable to start streaming: Invalid argument (22).
 
I got as well an empty file.h264 . ( i read about everything you talk about in all forum, but couldn't get the good solution).

I tried as well to use uv4l but with not much luck.

I don't know if the HDMI is encrypted with HDCP and if i need to buy HDMI splitter or if i did something wrong with the configuration.

If you have any idea, i would be very grateful.

NB : all gstreamer pipeline have been tested and approved with raspicam and webcam on computers.
NB2 : i'm currently using Pi 3b+ but i got in my possession PI4 as well. Should this works better on PI4 ?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8100
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 Jan 22, 2020 3:31 pm

tomcy21 wrote:
Wed Jan 22, 2020 2:03 pm
So i came here to understand my problem and make it work for the 2 others cameras.

i added dtoverlay=tc358743 in /boot/config.txt , added cma=32M, did rpi-update. I did provide EDID file with

Code: Select all

v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums 
i used v4l2-ctl --query-dv-timings to set the timing.
"v4l2-ctl --query-dv-timings" reports the currently detected timings. "v4l2-ctl --set-dv-bt-timings query" sets those detected timings as the current.
tomcy21 wrote:and tried again gstreamer command. However it seems that i can't read h264 from v4l2src, but onyl raw video. Using omxh264enc, the streaming seems to be launch correctly, but i can't get anything from the RTP client.
I tried to use your yavta module : but i got error

Code: Select all

 Unable to start streaming: Invalid argument (22).
 
I got as well an empty file.h264 . ( i read about everything you talk about in all forum, but couldn't get the good solution).

I tried as well to use uv4l but with not much luck.

I don't know if the HDMI is encrypted with HDCP and if i need to buy HDMI splitter or if i did something wrong with the configuration.

If you have any idea, i would be very grateful.

NB : all gstreamer pipeline have been tested and approved with raspicam and webcam on computers.
NB2 : i'm currently using Pi 3b+ but i got in my possession PI4 as well. Should this works better on PI4 ?
v4l2h264enc is recommended now over omxh264enc as it allows for zero copy passing of buffers around the place. It also natively supports the YUYV family of input formats, which is what you are most likely to want to capture.

You'll need to do a little more debugging into what video timings are being produced by your source, which "v4l2-ctl --query-dv-timings" will tell you. 1080p50 is the absolute maximum you can capture with 2 CSI2 data lanes connected. Up to 1080p30 can be run as BGR3, but over that has to be as UYVY.
Also add a format selection into the GStreamer pipeline to ensure it selects UYVY.

yavta should do all of that for you, but will still be unable to start streaming if the source is producing > 1080p50. In this case there should be a kernel error message of

Code: Select all

Device has requested 3 data lanes, which is >2 configured in DT
View the kernel logs using dmesg.
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.

tomcy21
Posts: 3
Joined: Wed Jan 22, 2020 1:22 pm

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

Wed Jan 22, 2020 5:08 pm

First, thank you for your answer !!
6by9 wrote:
Wed Jan 22, 2020 3:31 pm
"v4l2-ctl --query-dv-timings" reports the currently detected timings. "v4l2-ctl --set-dv-bt-timings query" sets those detected timings as the current.
Ok my bad, i did not notice the 2 different commands but i did execute them.
6by9 wrote:
Wed Jan 22, 2020 3:31 pm
v4l2h264enc is recommended now over omxh264enc as it allows for zero copy passing of buffers around the place. It also natively supports the YUYV family of input formats, which is what you are most likely to want to capture.

You'll need to do a little more debugging into what video timings are being produced by your source, which "v4l2-ctl --query-dv-timings" will tell you. 1080p50 is the absolute maximum you can capture with 2 CSI2 data lanes connected. Up to 1080p30 can be run as BGR3, but over that has to be as UYVY.
Also add a format selection into the GStreamer pipeline to ensure it selects UYVY.
I'm currently using gstreamer 1.10, given by apt for ubuntu 16.04 and v4l2 encoding was not available. Is it absolutely necessary ? My main goal rigth know is to be sure that camera + b101 + PI is working. Gstreamer, quality of the stream and latency will be my second problem.

The camera can do more than 1080p50 but isn't there a negotation between the camera and gstreamer (or via the EDID file) ?
6by9 wrote:
Wed Jan 22, 2020 3:31 pm
yavta should do all of that for you, but will still be unable to start streaming if the source is producing > 1080p50. In this case there should be a kernel error message of

Code: Select all

Device has requested 3 data lanes, which is >2 configured in DT
View the kernel logs using dmesg.
With yavta :
i set again EDID :

Code: Select all

 $ 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
then timings :

Code: Select all

$ v4l2-ctl --set-dv-bt-timings query
BT timings set
query timing gives me :

Code: Select all

$ v4l2-ctl --query-dv-timings
	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: 
With still 60 fps ?
but still yavta gives me Invalid argument (22) error :

Code: Select all

$ ./yavta --capture=1000 -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)(0x1758f60)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 0x1762d98
Sent buffer 0x1762f70
Sent buffer 0x1763148
Sent buffer 0x1763320
Sent buffer 0x17634f8
Sent buffer 0x17636d0
Sent buffer 0x17638a8
Sent buffer 0x1763a80
3 buffers requested, V4L2 returned 3 bufs.
length: 4177920 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x70704000.
Importing DMABUF 8 into VCSM...
...done. vcsm_handle 73728
Exported buffer 0 to dmabuf 8, vcsm handle 73728
Linking V4L2 buffer index 0 ptr 0x1764818 to MMAL header 0x175f490. mmal->data 0xC0000003
length: 4177920 offset: 4177920 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x70308000.
Importing DMABUF 9 into VCSM...
...done. vcsm_handle 77824
Exported buffer 1 to dmabuf 9, vcsm handle 77824
Linking V4L2 buffer index 1 ptr 0x1764888 to MMAL header 0x175f668. mmal->data 0xC0000004
length: 4177920 offset: 8355840 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x6ff0c000.
Importing DMABUF 10 into VCSM...
...done. vcsm_handle 81920
Exported buffer 2 to dmabuf 10, vcsm handle 81920
Linking V4L2 buffer index 2 ptr 0x17648f8 to MMAL header 0x175f840. mmal->data 0xC0000005
Unable to start streaming: Invalid argument (22).
Releasing vcsm handle 73728
Closing dma_buf 8
Releasing vcsm handle 77824
Closing dma_buf 9
Releasing vcsm handle 81920
Closing dma_buf 10
3 buffers released.
same question here, why is it displayed Framerate is 60 ?
i can't find the error you're talking about in kernel logs : (i did check the entire dmesg display without grep)

Code: Select all

$ dmesg | grep Device
[    0.801663] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    1.482216] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[    1.942194] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[    2.975115] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[    5.239648] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.247730] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.260109] bcm2835-codec bcm2835-codec: Device registered as /dev/video12

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8100
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 Jan 22, 2020 5:29 pm

tomcy21 wrote:
Wed Jan 22, 2020 5:08 pm
I'm currently using gstreamer 1.10, given by apt for ubuntu 16.04 and v4l2 encoding was not available. Is it absolutely necessary ? My main goal rigth know is to be sure that camera + b101 + PI is working. Gstreamer, quality of the stream and latency will be my second problem.
I don't believe omxh264enc supports UYVY as an input format, therefore it'll be doing a software conversion.
tomcy21 wrote:The camera can do more than 1080p50 but isn't there a negotation between the camera and gstreamer (or via the EDID file) ?
The sink (B101) has told the source what it can support, but some sources don't alter what they send based on it.
tomcy21 wrote:With yavta :
i set again EDID :

Code: Select all

 $ 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
then timings :

Code: Select all

$ v4l2-ctl --set-dv-bt-timings query
BT timings set
query timing gives me :

Code: Select all

$ v4l2-ctl --query-dv-timings
	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: 
With still 60 fps ?
If it's reporting 60fps, then you're stuck. It would appear your device isn't changing the format that it is generating, and it's a format that can't be accepted by the B101.
You could try editing the EDID to remove all 1080p modes, but I can't guarantee that that will help either.
tomcy21 wrote:i can't find the error you're talking about in kernel logs : (i did check the entire dmesg display without grep)

Code: Select all

$ dmesg | grep Device
[    0.801663] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[    1.482216] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[    1.942194] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
[    2.975115] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
[    5.239648] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    5.247730] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    5.260109] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
Looking again at the code, I think it may return an error internally and not log it.

If you run "v4l2-ctl --log-status" it'll dump out the state of the device. That should have entries for "Lanes needed:" and "Lanes in use:". I suspect Lanes needed will be 3, but you physically only have 2.
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.

tomcy21
Posts: 3
Joined: Wed Jan 22, 2020 1:22 pm

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

Thu Jan 23, 2020 10:58 am

6by9 wrote:
Wed Jan 22, 2020 5:29 pm
If it's reporting 60fps, then you're stuck. It would appear your device isn't changing the format that it is generating, and it's a format that can't be accepted by the B101.
You could try editing the EDID to remove all 1080p modes, but I can't guarantee that that will help either.
I modified EDID file to accept only 720p, edid-decode gave me :

Code: Select all

$ edid-decode < 720p60EDID.txt 
Extracted contents:
header:          00 ff ff ff ff ff ff 00
serial number:   52 62 88 88 00 88 88 88 1c 15
version:         01 03
basic params:    80 00 00 78 0a
chroma info:     ee 91 a3 54 4c 99 26 0f 50 54
established:     00 00 00
standard:        01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
descriptor 1:    01 1d 00 72 51 d0 1e 20 6e 28 55 00 c4 8e 21 00 00 1e
descriptor 2:    8c 0a d0 8a 20 e0 2d 10 10 3e 96 00 13 8e 21 00 00 1e
descriptor 3:    00 00 00 fc 00 54 6f 73 68 69 62 61 2d 48 32 43 0a 20
descriptor 4:    00 00 00 fd 00 3b 3d 0f 2e 0f 1e 0a 20 20 20 20 20 20
extensions:      01
checksum:        00

Manufacturer: TSB Model 8888 Serial Number 2290649088
Made week 28 of 2011
EDID version: 1.3
Digital display
Image size is variable
Gamma: 2.20
Supported color formats: RGB 4:4:4, YCrCb 4:4:4
First detailed timing is preferred timing
Established timings supported:
Standard timings supported:
Detailed mode: Clock 74.250 MHz, 708 mm x 398 mm
               1280 1390 1430 1650 hborder 0
                720  725  730  750 vborder 0
               +hsync +vsync 
Detailed mode: Clock 27.000 MHz, 531 mm x 398 mm
                720  736  798  858 hborder 0
                480  489  495  525 vborder 0
               +hsync +vsync 
Monitor name: Toshiba-H2C
Monitor ranges (invalid): 59-61Hz V, 15-46kHz H, max dotclock 150MHz
Has 1 extension blocks
Checksum: 0x0 (should be 0x4f)

CEA extension block
Extension version: 3
29 bytes of CEA data
  Video data block
    VIC   4 [email protected] (native)
    VIC  19 [email protected] 
    VIC   3 [email protected] 
    VIC   2 [email protected] 
    VIC  18 [email protected] 
    VIC  17 [email protected] 
    VIC   1 [email protected] 
    VIC  60 [email protected] 
    VIC  61 [email protected] 
    VIC  62 [email protected] 
  Audio data block
    Linear PCM, max channels 2
    Supported sample rates (kHz): 48 44.1 32
    Supported sample sizes (bits): 24 20 16
  Vendor-specific data block, OUI 000c03 (HDMI)
    Source physical address 3.0.0.0
    Supports_AI
  Extended tag: video capability data block
    YCbCr quantization: No Data (0)
    RGB quantization: Selectable (via AVI Q) (1)
    PT scan behaviour: Support both over- and underscan (3)
    IT scan behaviour: Support both over- and underscan (3)
    CE scan behaviour: Support both over- and underscan (3)
Basic audio support
3 native detailed modes
Detailed mode: Clock 27.000 MHz, 708 mm x 398 mm
                720  736  798  858 hborder 0
                480  489  495  525 vborder 0
               -hsync -vsync 
Detailed mode: Clock 27.000 MHz, 531 mm x 398 mm
                720  736  798  858 hborder 0
                480  489  495  525 vborder 0
               -hsync -vsync 
Detailed mode: Clock 27.000 MHz, 531 mm x 398 mm
               1440 1478 1602 1716 hborder 0
                240  244  247  262 vborder 0
               -hsync -vsync interlaced 
Checksum: 0x0 (should be 0xaa)

EDID block does not conform at all!
	Block has broken checksum
	Detailed blocks filled with garbage
	Range descriptor contains garbage
It looks ok.
I did the same manipulation as before, and got exactly the same result.
6by9 wrote:
Wed Jan 22, 2020 5:29 pm
Looking again at the code, I think it may return an error internally and not log it.

If you run "v4l2-ctl --log-status" it'll dump out the state of the device. That should have entries for "Lanes needed:" and "Lanes in use:". I suspect Lanes needed will be 3, but you physically only have 2.
Indeed, the state of the device gives :

Code: Select all

   [ 9267.152250] tc358743 0-000f: Lanes needed: 3
   [ 9267.152267] tc358743 0-000f: Lanes in use: 3
So clearly the camera doesn't change its resolution/fps accordingly to what b101 asks. I have find and have a look at the software related to the camera to set it up in a lower resolution.

Thank you very much for your answer !

luisete2
Posts: 4
Joined: Thu Jan 23, 2020 1:21 pm

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

Thu Jan 23, 2020 1:31 pm

Hello,

I've been seriously struggling with this for a long time now, and although I researched the whole topic on this and many more forums and instructions in https://www.linux-projects.org/, I've had no luck. I'll explain:

I want to get a live feed of a GoPro Hero 4 via preferably UV4L, using a RPi Zero W with the B102 board from Auvidea, with the TC358743 chip.

raspivid -t 0 is working flawlessly. I can get the feed of the GoPro locally at any resolution.

The streaming UV4L server also works with a regular PiCamera V2.

However, I'm not able to stream the GoPro to my server.

I tinkered with resolutions inside the camera, inside the UV4L conf file, and it's no use.

With the B102 plugged with the GoPro, the server starts normally:

Code: Select all

ene 23 13:27:25 dronecam uv4l[1004]: <notice> [driver] Selected format: 640x480, encoding: mjpeg, JPEG Video Capture
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [driver] Framerate max. 25 fps
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [core] Device detected!
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [core] Trying to load the the Streaming Server plug-in...
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [server] HTTP/HTTPS Streaming & WebRTC Signalling Server v1.1.125 built on Sep  5 2019
ene 23 13:27:25 dronecam uv4l[1004]: <warning> [server] SSL is not enabled for the Streaming Server. Using unsecure HTTP.
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [core] Streaming Server loaded!
ene 23 13:27:25 dronecam uv4l[1004]: <warning> [core] Cannot create /dev/video0 because file already exists
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [core] Registering device node /dev/video1
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [server] Web Streaming Server listening on port 8080
Right. But when I try to access the stream:
ene 23 13:27:25 dronecam uv4l[1004]: <notice> [server] Web Streaming Server listening on port 8080
ene 23 13:28:15 dronecam uv4l[1004]: <notice> [driver] Running /usr/share/uv4l/raspicam/tc358743_init.sh...
ene 23 13:28:15 dronecam uv4l[1004]: setting GPIO for board revsion: 9000c1
ene 23 13:28:15 dronecam uv4l[1004]: A+, B+, and B2 all revisions, Zero, Zero W - I2C 0 on GPIOs 28 & 29. GPIOs 32 & 41 for LED and power
ene 23 13:28:15 dronecam uv4l[1004]: Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
ene 23 13:28:15 dronecam uv4l[1004]: <notice> [driver] ...command returned normally, exit code 1
ene 23 13:28:15 dronecam uv4l[1004]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
ene 23 13:28:15 dronecam uv4l[1004]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
ene 23 13:28:15 dronecam uv4l[1004]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
ene 23 13:28:15 dronecam uv4l[1004]: <warning> [server] Remote I/O error
The stream gets stuck with no response and the status switches to that. Any ideas?

I don't mind using any other software as long as I can stream the GoPro through the RPi to an IP.

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

Thu Jan 23, 2020 3:15 pm

luisete2 wrote:
Thu Jan 23, 2020 1:31 pm
Hello,

I've been seriously struggling with this for a long time now, and although I researched the whole topic on this and many more forums and instructions in https://www.linux-projects.org/, I've had no luck. I'll explain:

I want to get a live feed of a GoPro Hero 4 via preferably UV4L, using a RPi Zero W with the B102 board from Auvidea, with the TC358743 chip.

raspivid -t 0 is working flawlessly. I can get the feed of the GoPro locally at any resolution.
Please note the message regarding support of the TC358743 via raspivid that is printed every time you support the app.
luisete2 wrote:The streaming UV4L server also works with a regular PiCamera V2.

However, I'm not able to stream the GoPro to my server.

I tinkered with resolutions inside the camera, inside the UV4L conf file, and it's no use.

Code: Select all

ene 23 13:27:25 dronecam uv4l[1004]: <notice> [server] Web Streaming Server listening on port 8080
ene 23 13:28:15 dronecam uv4l[1004]: <notice> [driver] Running /usr/share/uv4l/raspicam/tc358743_init.sh...
ene 23 13:28:15 dronecam uv4l[1004]: setting GPIO for board revsion: 9000c1
ene 23 13:28:15 dronecam uv4l[1004]: A+, B+, and B2 all revisions, Zero, Zero W - I2C 0 on GPIOs 28 & 29. GPIOs 32 & 41 for LED and power
ene 23 13:28:15 dronecam uv4l[1004]: Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
ene 23 13:28:15 dronecam uv4l[1004]: <notice> [driver] ...command returned normally, exit code 1
ene 23 13:28:15 dronecam uv4l[1004]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
ene 23 13:28:15 dronecam uv4l[1004]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
ene 23 13:28:15 dronecam uv4l[1004]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
ene 23 13:28:15 dronecam uv4l[1004]: <warning> [server] Remote I/O error
The stream gets stuck with no response and the status switches to that. Any ideas?

I don't mind using any other software as long as I can stream the GoPro through the RPi to an IP.
All support for UV4L needs to come from them as it is a closed source project.
However the error message

Code: Select all

Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
would imply you haven't added "dtparam=i2c_vc=on" to /boot/config.txt, and/or told the system to load i2c_dev to provide the userspace API to control I2C (enable I2C from raspi-config is the easiest way to do this).
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.

RpiName
Posts: 716
Joined: Sat Jul 06, 2013 3:14 am

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

Thu Jan 23, 2020 8:46 pm

luisete2 wrote:
Thu Jan 23, 2020 1:31 pm
I've been seriously struggling with this for a long time now, and although I researched the whole topic on this and many more forums and instructions in https://www.linux-projects.org/, I've had no luck. I'll explain:

ene 23 13:28:15 dronecam uv4l[1004]: Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
did you read the installation instructions carefully? as already said by 6by9, it seems you did not load the kernel modules and this is documented at the "TC358743" paragraph in this page:
http://www.linux-projects.org/uv4l/installation/

there should not be additional instructions for the pi zero.

Sackschlangen
Posts: 2
Joined: Sat Feb 01, 2020 8:43 pm

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

Sat Feb 01, 2020 9:02 pm

Hi,

I managed to get my setup working as it should thanks to this thread. I'm running a Pi2B+ with a TC358743-HDMI-Input-Card (Chinese replica) mainly to feed an old Plasma-Panel with fixed frequency with HDMI-Sources (e.g. AppleTV). One of my last issues is related to the non-square pixels of my Plasma, which is 16:9 with 1024x768 resolution. I previously managed to solve this issue with raspivid by modifying the source as described here https://www.raspberrypi.org/forums/view ... 35#p998561

Code: Select all

Code: Select all

param.set |= MMAL_DISPLAY_SET_NOASPECT;
param.noaspect= MMAL_TRUE;
However raspivid is buggy and unstable as said before. I was searching the yavta source up and down but it is talking to MMAL differently. Can anyone give me a hint how to set this parameter with yavta?

Thanks

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

Sun Feb 02, 2020 10:05 am

yavta uses MMAL in exactly the same way as raspivid, it has just omitted setting a display region so that it uses the default of stretching to full screen whilst maintaining aspect ratio.

Copy the section from https://github.com/raspberrypi/userland ... iew.c#L112 that configures the MMAL_DISPLAY_REGION_T and calls mmal_port_parameter_set, and paste it anywhere after the mmal_component_create("vc.ril.video_render",...) at https://github.com/6by9/yavta/blob/master/yavta.c#L1935. Amend the mmal_port_parameter_set from preview_port to dev->render->input[0].
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.

luisete2
Posts: 4
Joined: Thu Jan 23, 2020 1:21 pm

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

Mon Feb 03, 2020 10:48 am

First of all, thanks for the fast answers!
6by9 wrote:
Thu Jan 23, 2020 3:15 pm
However the error message

Code: Select all

Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
would imply you haven't added "dtparam=i2c_vc=on" to /boot/config.txt, and/or told the system to load i2c_dev to provide the userspace API to control I2C (enable I2C from raspi-config is the easiest way to do this).
Okay, done this! The error is now:

Code: Select all

feb 03 10:26:05 dronecam uv4l[304]: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
feb 03 10:26:05 dronecam uv4l[304]: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
feb 03 10:26:05 dronecam uv4l[304]: 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
feb 03 10:26:05 dronecam uv4l[304]: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
feb 03 10:26:05 dronecam uv4l[304]: 70: -- -- -- -- -- -- -- --
feb 03 10:26:05 dronecam uv4l[304]: <notice> [driver] ...command returned with exit code 0
feb 03 10:26:05 dronecam uv4l[304]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
feb 03 10:26:05 dronecam uv4l[304]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
feb 03 10:26:05 dronecam uv4l[304]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
feb 03 10:26:05 dronecam uv4l[304]: <warning> [server] Remote I/O error
RpiName wrote:
did you read the installation instructions carefully? as already said by 6by9, it seems you did not load the kernel modules and this is documented at the "TC358743" paragraph in this page:
http://www.linux-projects.org/uv4l/installation/
As for this, yes, I installed the -extras package and followed the instructions, although I admit I didn't enable the I2C. In the /etc/modules file, I corrected the

Code: Select all

i2c-bcm-2708
line to:

Code: Select all

i2c-bcm2708
but it made no difference. Any other suggestions? I'm forcing the TC358743 in the config file to emit in 640x480 / 25 frames. I believe the GoPro is emitting in 1080p / 25 frames but I don't know if lowering that resolution will help.

EDIT: I also tried to find an EDID file for the GoPro HERO 4 but to no avail. I'm not passing any EDID at the moment.

luisete2
Posts: 4
Joined: Thu Jan 23, 2020 1:21 pm

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

Mon Feb 03, 2020 11:32 am

Okay, got it!!! It was a matter of updating the i2c-dev to the right interface.

Sackschlangen
Posts: 2
Joined: Sat Feb 01, 2020 8:43 pm

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

Tue Feb 04, 2020 10:19 pm

Hi,

it took pretty long until my post was published, thus meanwhile I figured out a similar way to get my problem fixed by adding the last two lines into your code:

Code: Select all

.....

static int setup_mmal(struct device *dev, int nbufs, int do_encode, const char *filename)
{
	MMAL_STATUS_T status;
	VCOS_STATUS_T vcos_status;
	MMAL_PORT_T *port;
	const struct v4l2_format_info *info;
	struct v4l2_format fmt;
	int ret;
	MMAL_PORT_T *isp_output, *encoder_input = NULL, *encoder_output = NULL;

	//FIXME: Clean up after errors

	status = mmal_component_create("vc.ril.isp", &dev->isp);
	if(status != MMAL_SUCCESS)
	{
		print("Failed to create isp\n");
		return -1;
	}

	if (do_encode)
	{
		status = mmal_component_create("vc.ril.video_encode", &dev->encoder);
		if(status != MMAL_SUCCESS)
		{
			print("Failed to create encoder");
			return -1;
		}
		encoder_input = dev->encoder->input[0];
		encoder_output = dev->encoder->output[0];
	}

	if (1)
	{
		status = mmal_component_create("vc.ril.video_render", &dev->render);
		if(status != MMAL_SUCCESS)
		{
			print("Failed to create render\n");
			return -1;
		}
	}

	port = dev->isp->input[0];

	memset(&fmt, 0, sizeof fmt);
	fmt.type = dev->type;

	ret = ioctl(dev->fd, VIDIOC_G_FMT, &fmt);
	if (ret < 0) {
		print("Unable to get format: %s (%d).\n", strerror(errno),
			errno);
		return ret;
	}

	info = v4l2_format_by_fourcc(fmt.fmt.pix.pixelformat);
	if (!info || info->mmal_encoding == MMAL_ENCODING_UNUSED)
	{
		print("Unsupported encoding\n");
		return -1;
	}
	port->format->encoding = info->mmal_encoding;
	port->format->es->video.crop.width = fmt.fmt.pix.width;
	port->format->es->video.crop.height = fmt.fmt.pix.height;
	port->format->es->video.width = (port->format->es->video.crop.width+31) & ~31;
	//mmal_encoding_stride_to_width(port->format->encoding, fmt.fmt.pix.bytesperline);
	/* FIXME - buffer may not be aligned vertically */
	port->format->es->video.height = (fmt.fmt.pix.height+15) & ~15;	
	//Ignore for now, but will be wanted for video encode.
	//port->format->es->video.frame_rate.num = 10000;
	//port->format->es->video.frame_rate.den = frame_interval ? frame_interval : 10000;
	port->buffer_num = nbufs;

	port->format->es->video.par.num = 100;
        port->format->es->video.par.den = 133;


which makes 16:9 sources be rendered in fullscreen on my plasma now. Anyway thank you for your quick reply.

One final thing I'm dealing with it getting audio to work. Following your advice on page 17 I've setup up anything as it should and I it seems to work correctly

Code: Select all

[email protected]:~ $ 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

Digital Video Controls

                  power_present 0x00a00964 (bitmask): max=0x00000001 default=0x00000000 value=0x00000001 flags=read-only
[email protected]:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[email protected]:~ $ arecord -D hw:1,0 -d 1 -f dat test1.wav
Recording WAVE 'test1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo


But arecord produces an silent file

Code: Select all

[email protected]:~ $ xxd test1.wav
00000000: 5249 4646 24ee 0200 5741 5645 666d 7420  RIFF$...WAVEfmt 
00000010: 1000 0000 0100 0200 80bb 0000 00ee 0200  ................
00000020: 0400 1000 6461 7461 00ee 0200 4bec 3702  ....data....K.7.
00000030: 4bec 3702 4bec 3702 4bec 3702 4bec 3702  K.7.K.7.K.7.K.7.
00000040: 4bec 3702 4bec 3702 4bec 3702 4bec 3702  K.7.K.7.K.7.K.7.
00000050: 4bec 3702 4bec 3702 4bec 3702 4bec 3702  K.7.K.7.K.7.K.7.
...
I've checked the wiring several times and should be fine. Of course there is audio present at the moment of recording. Do you have any suggestions to this issue as well?

Thanks again

ninja8
Posts: 3
Joined: Wed Apr 08, 2015 8:09 pm

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

Wed Feb 05, 2020 2:01 am

Hi All,

Just wondering whether anyone is running the B101 attached to the Rpi4 but with the Rpi4 using a PoE hat for power (rather than USB-C plug)? Should the B101 be compatible with such a setup receiving power from PoE?

Thanks!

NKnuelle
Posts: 14
Joined: Tue Mar 24, 2020 9:30 am

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

Fri Mar 27, 2020 10:50 am

Hi all,

I try to set the dv-timings via v4l2 --set-dv-timings to the detected input format.

Is this possible without having to provide an EDID file?

This is the output with

Code: Select all

v4l2-ctl --log-status
:

Code: Select all

   [ 7190.336255] unicam fe801000.csi: =================  START STATUS  =================
   [ 7190.337938] tc358743 0-000f: -----Chip status-----
   [ 7190.338562] tc358743 0-000f: Chip ID: 0x00
   [ 7190.339183] tc358743 0-000f: Chip revision: 0x00
   [ 7190.339195] tc358743 0-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 7190.339204] tc358743 0-000f: Sleep mode: off
   [ 7190.339214] tc358743 0-000f: Cable detected (+5V power): yes
   [ 7190.339744] tc358743 0-000f: DDC lines enabled: yes
   [ 7190.340274] tc358743 0-000f: Hotplug enabled: yes
   [ 7190.340895] tc358743 0-000f: CEC enabled: no
   [ 7190.340904] tc358743 0-000f: -----Signal status-----
   [ 7190.340913] tc358743 0-000f: TMDS signal detected: yes
   [ 7190.340923] tc358743 0-000f: Stable sync signal: yes
   [ 7190.340932] tc358743 0-000f: PHY PLL locked: yes
   [ 7190.340941] tc358743 0-000f: PHY DE detected: yes
   [ 7190.347726] tc358743 0-000f: Detected format: 1920x1080i25.0 (2640x562)
   [ 7190.347739] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
   [ 7190.347750] tc358743 0-000f: vertical: fp = 0, -sync = 22, bp = 0
   [ 7190.347761] tc358743 0-000f: vertical bottom field: fp = 0, -sync = 23, bp = 0
   [ 7190.347771] tc358743 0-000f: pixelclock: 37092000
   [ 7190.347782] tc358743 0-000f: flags (0x0):
   [ 7190.347792] tc358743 0-000f: standards (0x0):
   [ 7190.347805] tc358743 0-000f: Configured format: 640x480p59.94 (800x525)
   [ 7190.347816] tc358743 0-000f: horizontal: fp = 16, -sync = 96, bp = 48
   [ 7190.347827] tc358743 0-000f: vertical: fp = 10, -sync = 2, bp = 33
   [ 7190.347836] tc358743 0-000f: pixelclock: 25175000
   [ 7190.347848] tc358743 0-000f: flags (0x80): HAS_CEA861_VIC
   [ 7190.347858] tc358743 0-000f: standards (0x3): CEA DMT
   [ 7190.347869] tc358743 0-000f: CEA-861 VIC: 1
   [ 7190.347878] tc358743 0-000f: -----CSI-TX status-----
   [ 7190.347888] tc358743 0-000f: Lanes needed: 1
   [ 7190.347897] tc358743 0-000f: Lanes in use: 1
   [ 7190.348518] tc358743 0-000f: Waiting for particular sync signal: no
   [ 7190.349138] tc358743 0-000f: Transmit mode: no
   [ 7190.349757] tc358743 0-000f: Receive mode: no
   [ 7190.350377] tc358743 0-000f: Stopped: no
   [ 7190.350387] tc358743 0-000f: Color space: RGB 888 24-bit
   [ 7190.350916] tc358743 0-000f: -----HDMI status-----
   [ 7190.350925] tc358743 0-000f: HDCP encrypted content: no
   [ 7190.350935] tc358743 0-000f: Input color space: RGB limited range
   [ 7190.351480] tc358743 0-000f: AV Mute: off
   [ 7190.352018] tc358743 0-000f: Deep color mode: 8-bits per channel
   [ 7190.354521] tc358743 0-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [ 7190.354533] tc358743 0-000f:     colorspace: RGB
   [ 7190.354545] tc358743 0-000f:     scan mode: No Data
   [ 7190.354556] tc358743 0-000f:     colorimetry: Extended
   [ 7190.354567] tc358743 0-000f:     picture aspect: No Data
   [ 7190.354579] tc358743 0-000f:     active aspect: Same as Picture
   [ 7190.354590] tc358743 0-000f:     itc: IT Content
   [ 7190.354601] tc358743 0-000f:     extended colorimetry: BT.2020
   [ 7190.354612] tc358743 0-000f:     quantization range: Default
   [ 7190.354623] tc358743 0-000f:     nups: Unknown Non-uniform Scaling
   [ 7190.354634] tc358743 0-000f:     video code: 20
   [ 7190.354645] tc358743 0-000f:     ycc quantization range: Limited
   [ 7190.354655] tc358743 0-000f:     hdmi content type: Photo
   [ 7190.354667] tc358743 0-000f:     pixel repeat: 0
   [ 7190.354680] tc358743 0-000f:     bar top 0, bottom 0, left 0, right 0
   [ 7190.354690] unicam fe801000.csi: -----Receiver status-----
   [ 7190.354700] unicam fe801000.csi: V4L2 width/height:   640x480
   [ 7190.354710] unicam fe801000.csi: Mediabus format:     0000100a
   [ 7190.354721] unicam fe801000.csi: V4L2 format:         RGB3
   [ 7190.354731] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 7190.354740] unicam fe801000.csi: ----Live data----
   [ 7190.354750] unicam fe801000.csi: Programmed stride:      0
   [ 7190.354760] unicam fe801000.csi: Detected resolution: 0x0
   [ 7190.354770] unicam fe801000.csi: Write pointer:       00000000
   [ 7190.354779] unicam fe801000.csi: ==================  END STATUS  ==================
I just want to change the configured format to the detected format (which is 1080i25 so 50 interlaced frames). Or do I have to write an 1080i25 EDID file my self? Any hints on how to do that? I need this to stream the HDMI input via GStreamer.

Thank you in advance

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8100
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 Mar 27, 2020 11:59 am

NKnuelle wrote:
Fri Mar 27, 2020 10:50 am
I try to set the dv-timings via v4l2 --set-dv-timings to the detected input format.

Is this possible without having to provide an EDID file?
If your source is ignoring the EDID totally, then you can do what you like.
NKnuelle wrote:This is the output with

Code: Select all

v4l2-ctl --log-status
:

Code: Select all

   [ 7190.336255] unicam fe801000.csi: =================  START STATUS  =================
   [ 7190.337938] tc358743 0-000f: -----Chip status-----
   [ 7190.338562] tc358743 0-000f: Chip ID: 0x00
   [ 7190.339183] tc358743 0-000f: Chip revision: 0x00
   [ 7190.339195] tc358743 0-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 7190.339204] tc358743 0-000f: Sleep mode: off
   [ 7190.339214] tc358743 0-000f: Cable detected (+5V power): yes
   [ 7190.339744] tc358743 0-000f: DDC lines enabled: yes
   [ 7190.340274] tc358743 0-000f: Hotplug enabled: yes
   [ 7190.340895] tc358743 0-000f: CEC enabled: no
   [ 7190.340904] tc358743 0-000f: -----Signal status-----
   [ 7190.340913] tc358743 0-000f: TMDS signal detected: yes
   [ 7190.340923] tc358743 0-000f: Stable sync signal: yes
   [ 7190.340932] tc358743 0-000f: PHY PLL locked: yes
   [ 7190.340941] tc358743 0-000f: PHY DE detected: yes
   [ 7190.347726] tc358743 0-000f: Detected format: 1920x1080i25.0 (2640x562)
   [ 7190.347739] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
   [ 7190.347750] tc358743 0-000f: vertical: fp = 0, -sync = 22, bp = 0
   [ 7190.347761] tc358743 0-000f: vertical bottom field: fp = 0, -sync = 23, bp = 0
   [ 7190.347771] tc358743 0-000f: pixelclock: 37092000
   [ 7190.347782] tc358743 0-000f: flags (0x0):
   [ 7190.347792] tc358743 0-000f: standards (0x0):
   [ 7190.347805] tc358743 0-000f: Configured format: 640x480p59.94 (800x525)
   [ 7190.347816] tc358743 0-000f: horizontal: fp = 16, -sync = 96, bp = 48
   [ 7190.347827] tc358743 0-000f: vertical: fp = 10, -sync = 2, bp = 33
   [ 7190.347836] tc358743 0-000f: pixelclock: 25175000
   [ 7190.347848] tc358743 0-000f: flags (0x80): HAS_CEA861_VIC
   [ 7190.347858] tc358743 0-000f: standards (0x3): CEA DMT
   [ 7190.347869] tc358743 0-000f: CEA-861 VIC: 1
   [ 7190.347878] tc358743 0-000f: -----CSI-TX status-----
   [ 7190.347888] tc358743 0-000f: Lanes needed: 1
   [ 7190.347897] tc358743 0-000f: Lanes in use: 1
   [ 7190.348518] tc358743 0-000f: Waiting for particular sync signal: no
   [ 7190.349138] tc358743 0-000f: Transmit mode: no
   [ 7190.349757] tc358743 0-000f: Receive mode: no
   [ 7190.350377] tc358743 0-000f: Stopped: no
   [ 7190.350387] tc358743 0-000f: Color space: RGB 888 24-bit
   [ 7190.350916] tc358743 0-000f: -----HDMI status-----
   [ 7190.350925] tc358743 0-000f: HDCP encrypted content: no
   [ 7190.350935] tc358743 0-000f: Input color space: RGB limited range
   [ 7190.351480] tc358743 0-000f: AV Mute: off
   [ 7190.352018] tc358743 0-000f: Deep color mode: 8-bits per channel
   [ 7190.354521] tc358743 0-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [ 7190.354533] tc358743 0-000f:     colorspace: RGB
   [ 7190.354545] tc358743 0-000f:     scan mode: No Data
   [ 7190.354556] tc358743 0-000f:     colorimetry: Extended
   [ 7190.354567] tc358743 0-000f:     picture aspect: No Data
   [ 7190.354579] tc358743 0-000f:     active aspect: Same as Picture
   [ 7190.354590] tc358743 0-000f:     itc: IT Content
   [ 7190.354601] tc358743 0-000f:     extended colorimetry: BT.2020
   [ 7190.354612] tc358743 0-000f:     quantization range: Default
   [ 7190.354623] tc358743 0-000f:     nups: Unknown Non-uniform Scaling
   [ 7190.354634] tc358743 0-000f:     video code: 20
   [ 7190.354645] tc358743 0-000f:     ycc quantization range: Limited
   [ 7190.354655] tc358743 0-000f:     hdmi content type: Photo
   [ 7190.354667] tc358743 0-000f:     pixel repeat: 0
   [ 7190.354680] tc358743 0-000f:     bar top 0, bottom 0, left 0, right 0
   [ 7190.354690] unicam fe801000.csi: -----Receiver status-----
   [ 7190.354700] unicam fe801000.csi: V4L2 width/height:   640x480
   [ 7190.354710] unicam fe801000.csi: Mediabus format:     0000100a
   [ 7190.354721] unicam fe801000.csi: V4L2 format:         RGB3
   [ 7190.354731] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 7190.354740] unicam fe801000.csi: ----Live data----
   [ 7190.354750] unicam fe801000.csi: Programmed stride:      0
   [ 7190.354760] unicam fe801000.csi: Detected resolution: 0x0
   [ 7190.354770] unicam fe801000.csi: Write pointer:       00000000
   [ 7190.354779] unicam fe801000.csi: ==================  END STATUS  ==================
That all looks reasonable, although I'm assuming that's before you've done "v4l2-ctl --set-dv-timings query" as the configured resolution is 640x480p59.94
The "extended colorimetry: BT.2020" is a little odd. BT.2020 is normally only used for 4k video. 1080 anything would generally be BT.709.
Listing as "video code: 20" also implies this is really 1080i50 (50 fields / 25 frames per second), but the pixel clock says otherwise.
It's a very odd looking signal!
NKnuelle wrote:I just want to change the configured format to the detected format (which is 1080i25 so 50 interlaced frames). Or do I have to write an 1080i25 EDID file my self? Any hints on how to do that? I need this to stream the HDMI input via GStreamer.
The little word "interlaced" is where you're going to trip up - the TC358743 isn't configured for that, and the way it implements identifying the fields isn't really supported by the Pi's receiver. (It uses two different image ID fields to reflect odd and even fields).

I did manage to hack together the signalling for the Analog Devices ADV728x devices which signal the field via the line number field in the frame start. See https://github.com/6by9/linux/tree/rpi- ... interlaced.
If you make a couple of changes:
to the tc358743 driver:
- to advertise support for other field modes than V4L2_FIELD_NONE (https://elixir.bootlin.com/linux/v4.19. ... 43.c#L1678). I suspect that line wants to be format->format.field = state->timings.bt.interlaced ? V4L2_FIELD_ALTERNATE : V4L2_FIELD_NONE;
- Ideally set the value for register 0x000C (identified in the data sheet as PacketID1). Bits 7:0 are the CSI data ID used for top fields (VPID0), whilst bits 15:8 are the data ID used for the top field (VPID1). Defaults are VPID0=0x35, and VPID1=0x34.

to the Unicam driver to
- cherry-pick my commit from rpi-4.14.y-unicam-interlaced to allow interlaced modes.
- the trickier one is how to select the appropriate CSI data ID values to use. The register UNICAM_IDI0 that the csi_dt value gets written to actually u32 and takes 4 potential csi_dt values. I don't think there is a generic way to support this, so the simplest is to hack struct unicam_fmt so that csi_dt is u32, and then amend the entry for V4L2_PIX_FMT_BGR24 to be 0x3435.
- amend my interlaced modes patch so that in unicam_isr it is looking doing "frame_number = get_field(cap0, UNICAM_CDT_MASK)) == 0x34 ? 1 : 2;". Actually better would be to pass the field enum into unicam_process_buffer_complete instead of a line number. Then you can do "field = get_field(cap0, UNICAM_CDT_MASK)) == 0x34 ? V4L2_FIELD_BOTTOM : V4L2_FIELD_TOP;"

So you have a chance of doing it, and it'd be interesting to see if it can work.
Getting GStreamer to stream that may be trickier as the hardware H264 encoder does not support interlaced video, therefore it'll need to do a software deinterlace on it before encoding.
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.

TanaPanda
Posts: 2
Joined: Wed Apr 01, 2020 2:39 pm

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

Wed Apr 01, 2020 2:44 pm

@6by9 I am working with the B101 HDMI Input board. I am having trouble wading through this forum on how to get audio to work. What I am trying to accomplish is connecting lets say DVD player > B101 > Raspberry Pi > Computer via Ethernet I would like to take the HDMI video and Audio in through the B101 and send it out via UDP from the PI. I was trying to private message 6by9 but I am new to this forum and could not figure that out. Assistance would be great. I have enabled the camera and verified that I am getting video. Its the audio that I cant seem to find a clear answer on.

Return to “Graphics, sound and multimedia”