6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Jul 01, 2018 8:54 am

https://github.com/raspberrypi/linux/pull/2513 was merged on Friday, but hasn't hit rpi-update quite yet.
There are still some device tree changes to resolve before the standard kernel has easy to use support, but I'll sort out some temporary changes on Monday.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jwpalermo
Posts: 12
Joined: Fri Jun 15, 2018 1:58 am

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

Mon Jul 02, 2018 3:07 pm

https://github.com/raspberrypi/linux/pull/2513 was merged on Friday, but hasn't hit rpi-update quite yet.
There are still some device tree changes to resolve before the standard kernel has easy to use support, but I'll sort out some temporary changes on Monday.
@6By9 - Thank you. I would love to try testing what you have in mind. If you do make some changes please let me know what you did and how to use it.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Jul 10, 2018 2:27 pm

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).

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.
Last edited by 6by9 on Wed Sep 26, 2018 4:23 pm, edited 2 times in total.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jwpalermo
Posts: 12
Joined: Fri Jun 15, 2018 1:58 am

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

Sat Jul 14, 2018 7:23 pm

@6By9 Thanks a lot for your work!

I'm trying to use it now, and I think I'll need some debugging help. I've started a new thread to discuss it: viewtopic.php?f=38&t=218138&p=1340831#p1340831

ahmed mosad
Posts: 16
Joined: Sun Jun 03, 2018 10:41 pm

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

Thu Aug 16, 2018 5:31 am

hi my friend i can't to run the b101
please this are the steps i followed :
1- i burned this image : 2018-04-18-raspbian-stretch.img
2- i added "cma=32M" to boot/config.txt
3-

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
cma=32M
dtparam=audio=on
start_x=1
gpu_mem=128
enable_uart=1
dtoverlay=w1-gpio


4- i updated the raspberry pi using this commands

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
5- after the updating its my kernel :

Code: Select all

Linux raspberrypi 4.14.61-v7+ #1133 SMP Fri Aug 10 11:04:43 BST 2018 armv7l GNU/Linux
6-then i added this lines to boot/config.txt

Code: Select all

dtoverlay=tc358743
dtoverlay=tc358743-audio
7-so the final boot/gonfig.txt

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
cma=32M
dtparam=audio=on
start_x=1
gpu_mem=128
dtoverlay=tc358743
enable_uart=1
dtoverlay=w1-gpio
dtoverlay=tc358743-audio
8-after running raspivid -t 0
i recieved this message and also there isn't video0 in dev directory "/dev/video0"
Image


9-its my hardware connections
Image

10-now its my raspberry pi 3 connection the HDMI input : Xbox 360 the HDMI output: TV
Image


please help me

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Aug 16, 2018 9:47 am

ahmed mosad wrote:
Thu Aug 16, 2018 5:31 am
hi my friend i can't to run the b101
please this are the steps i followed :
1- i burned this image : 2018-04-18-raspbian-stretch.img
2- i added "cma=32M" to boot/config.txt
3-

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
<snip>
You've installed all the new drivers, and then tried to use the old software. Please note part of the error message you got:

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.
With the new drivers you need to load an EDID, set the HDMI timings (they are also autodetected), and be using a V4L2 application of some form.
The yavta app that has been linked to numerous times will do the 2nd two bits, and v4l2-ctl can do the first bit for you.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ahmed mosad
Posts: 16
Joined: Sun Jun 03, 2018 10:41 pm

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

Sat Aug 18, 2018 4:51 pm

hi i followed this instructions

Code: Select all

git clone git://git.linuxtv.org/v4l-utils.git
cd v4l-utils
sudo apt-get install autoconf gettext libtool libjpeg62-dev

but there it is stopped so because this dependant libjpeg62
so i installed it

Code: Select all

sudo apt-get install libjpeg62
and it solved the problem but removed 155 package from the system
then i followed as

Code: Select all

sudo apt-get install autoconf gettext libtool libjpeg62-dev
# Configure and build it.
./bootstrap.sh
./configure
make
sudo make install
sudo modprobe bcm2835-v4l2
then i excuted this command

Code: Select all

v4l2-ctl --overlay=1
but it needed this package so i installed it as

Code: Select all

sudo apt-get install libv4l-dev
after thats i excuted this command with no errors

Code: Select all

v4l2-ctl --overlay=1
but now changes
also i tried

Code: Select all

raspivid -t 0
same error
so i rebooted the pi
but the raspberry but stopped working not booted again

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Aug 18, 2018 5:28 pm

Those are instructions for the Pi camera v4l2 driver, not for the tc358743.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ahmed mosad
Posts: 16
Joined: Sun Jun 03, 2018 10:41 pm

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

Sat Aug 18, 2018 6:22 pm

thanks for your Quick replay , i am very thanks for your Patience and keep support

can you guide me pelase to how i can download UV4L driver for TC358743
any link for download or any helpfull blog , what i can find a lot of talk about topi with no correct steps to do that

ahmed mosad
Posts: 16
Joined: Sun Jun 03, 2018 10:41 pm

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

Mon Aug 20, 2018 8:36 am

thasnk you for your time i followed this instructions
https://www.linux-projects.org/uv4l/installation/

Code: Select all

curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -
and added to file /etc/apt/sources.list this line

Code: Select all

deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main
and i excuted this lines

Code: Select all

sudo apt-get update
sudo apt-get install uv4l uv4l-raspicam
sudo apt-get install uv4l-raspicam-extras
sudo apt-get install uv4l-tc358743-extras
and made sure the line tc358743=yes is present or uncommented in the configuration file /etc/uv4l/uv4l-raspicam.conf.
then updated the kernel

Code: Select all

sudo rpi-update
now when i excute this commmand

Code: Select all

raspivid -t 0
i still get this message
Image
please how to test if the driver is installed and every thing is well

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

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

Mon Aug 20, 2018 9:07 am

ahmed mosad wrote:
Mon Aug 20, 2018 8:36 am
thasnk you for your time i followed this instructions
https://www.linux-projects.org/uv4l/installation/

Code: Select all

raspivid -t 0
raspvid has absolutely nothing to do with UV4L. Please read the UV4L installation instructions carefully. As said there, I suggest that you also install the uv4l-server and uv4l-webrtc modules to easily test if everything is working as expected, e.g. by streaming from the http://<rpi-address>:8080/stream/webrtc web page with Firefox from your PC.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 20, 2018 9:20 am

For UV4L, follow the instructions on their website (as RpiName says). Do NOT add any extra settings to /boot/config.txt other than those mentioned on their website (definitely do NOT add anything referencing tc358743).

For the kernel drivers, follow the steps in https://www.raspberrypi.org/forums/view ... 0#p1339178. yavta, GStreamer, or FFmpeg are the apps you really want to be looking at to work with that driver.

The use of raspivid with B101/B102 is unsupported. Please note that message that you have posted the screenshot of - "requests for support or changes will not be acted on". We will not offer any form of support for it.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Koda
Posts: 13
Joined: Sat Aug 18, 2018 1:52 pm

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

Fri Aug 24, 2018 2:16 pm

I have buy a B101 and have installed on RPI 3B+

I used this tutorial https://www.linux-projects.org/uv4l/installation/
My steps:

Code: Select all

curl http://www.linux-projects.org/listing/uv4l_repo/lpkey.asc | sudo apt-key add -
nano /etc/apt/sources.list and ADD
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/stretch stretch main
sudo apt-get update
apt-get update && apt-get dist-upgrade && apt-get autoremove
sudo apt-get install uv4l uv4l-raspicam
raspi-config
ENABLE Camera interface and the I2C bus
Change GPU Memory to 256
rpi-update
sudo apt-get install uv4l-raspicam-extras uv4l-tc358743-extras
nano /etc/uv4l/uv4l-raspicam.conf ADD
tc358743=yes
tc358743-i2c-dev = /dev/i2c-1
apt-get install uv4l-server uv4l-uvc uv4l-xscreen uv4l-mjpegstream uv4l-dummy uv4l-raspidisp
After reboot, it seems to be working:

Code: Select all

sudo service uv4l_raspicam status
● uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-24 16:10:50 CEST; 3min 41s ago
 Main PID: 384 (uv4l)
   CGroup: /system.slice/uv4l_raspicam.service
           └─384 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf

Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [driver] Selected format: 1920x1080, encoding: mjpeg, JPEG Video Capture
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [driver] Framerate max. 30 fps
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [core] Device detected!
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [core] Trying to load the the Streaming Server plug-in...
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [server] HTTP/HTTPS Streaming & WebRTC Signalling Server v1.1.116 built on Jul  6 2018
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [server] SSL is enabled for the Streaming Server. Using secure HTTPS.
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [core] Streaming Server loaded!
Aug 24 16:10:50 RPI01 uv4l[384]: <warning> [core] Cannot create /dev/video0 because file already exists
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [core] Registering device node /dev/video1
Aug 24 16:10:50 RPI01 uv4l[384]: <notice> [server] Web Streaming Server listening on port 8080
Now I call this URL: https://192.168.1.54:8080/stream/video.mjpeg
I see a black site, and the Status changed:

Code: Select all

sudo service uv4l_raspicam status
● uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-24 16:10:50 CEST; 4min 39s ago
 Main PID: 384 (uv4l)
   CGroup: /system.slice/uv4l_raspicam.service
           └─384 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf

Aug 24 16:15:26 RPI01 uv4l[384]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
Aug 24 16:15:26 RPI01 uv4l[384]: <warning> [server] Remote I/O error
Aug 24 16:15:26 RPI01 uv4l[384]: <notice> [driver] Running /usr/share/uv4l/raspicam/tc358743_init.sh...
Aug 24 16:15:26 RPI01 uv4l[384]: setting GPIO for board revsion: a020d3
Aug 24 16:15:26 RPI01 uv4l[384]: Failed: don't know how to set GPIO for this board!
Aug 24 16:15:26 RPI01 uv4l[384]: <notice> [driver] ...command returned with exit code 0
Aug 24 16:15:26 RPI01 uv4l[384]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
Aug 24 16:15:26 RPI01 uv4l[384]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
Aug 24 16:15:26 RPI01 uv4l[384]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
Aug 24 16:15:26 RPI01 uv4l[384]: <warning> [server] Remote I/O error
Can anyone help me?

EDIT: I have try to change /usr/share/uv4l/raspicam/tc358743_init.sh

Code: Select all

'0010'|'0012'|'0013'|'1041'|'a01040'|'a21041'|'900093'|'2a01041'|'a22042'|'9000c1'|'900092'|'900093'|'920093')

to
'0010'|'0012'|'0013'|'1041'|'a01040'|'a21041'|'900093'|'2a01041'|'a22042'|'9000c1'|'900092'|'900093'|'920093'|'a020d3')
The error changed to

Code: Select all

sudo service uv4l_raspicam status
● uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-24 16:24:47 CEST; 54s ago
 Main PID: 400 (uv4l)
   CGroup: /system.slice/uv4l_raspicam.service
           └─400 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf

Aug 24 16:25:38 RSP02 uv4l[400]: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:25:38 RSP02 uv4l[400]: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:25:38 RSP02 uv4l[400]: 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:25:38 RSP02 uv4l[400]: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:25:38 RSP02 uv4l[400]: 70: -- -- -- -- -- -- -- --
Aug 24 16:25:38 RSP02 uv4l[400]: <notice> [driver] ...command returned with exit code 0
Aug 24 16:25:38 RSP02 uv4l[400]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
Aug 24 16:25:38 RSP02 uv4l[400]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
Aug 24 16:25:38 RSP02 uv4l[400]: <error> [core] open() failed: failed to read register: Remote I/O error error: Remote I/O error
Aug 24 16:25:38 RSP02 uv4l[400]: <warning> [server] Remote I/O error
Last edited by Koda on Fri Aug 24, 2018 2:30 pm, edited 1 time in total.

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

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

Fri Aug 24, 2018 2:30 pm

Koda wrote:
Fri Aug 24, 2018 2:16 pm
I have buy a B101 and have installed on RPI 3B+

Code: Select all

Aug 24 16:15:26 RPI01 uv4l[384]: setting GPIO for board revsion: a020d3
Aug 24 16:15:26 RPI01 uv4l[384]: Failed: don't know how to set GPIO for this board!
Aug 24 16:15:26 RPI01 uv4l[384]: <notice> [driver] ...command returned with exit code 0
Aug 24 16:15:26 RPI01 uv4l[384]: <error> [driver] Failed to read register 8521 from f failed, err ffffffff
Aug 24 16:15:26 RPI01 uv4l[384]: <error> [driver] Failed to write register 8544 from f failed, err ffffffff
Can anyone help me?
The new Rpi 3B+ model has not been tested yet. But, assuming the 3B+ uses the same GPIOs as the previous 3, you can hopefully fix that by modifying /usr/share/uv4l/raspicam/tc358743_init.sh by adding the 'a020d3' case to the first line below:

Code: Select all

'a02082'|'a22082'|'a32082'|'2a02082')
echo "Raspberry Pi3"

Koda
Posts: 13
Joined: Sat Aug 18, 2018 1:52 pm

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

Fri Aug 24, 2018 2:34 pm

Thank you

The new error is this

Code: Select all

sudo service uv4l_raspicam status
● uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-24 16:31:55 CEST; 49s ago
 Main PID: 435 (uv4l)
   CGroup: /system.slice/uv4l_raspicam.service
           └─435 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf

Aug 24 16:32:37 RSP02 uv4l[435]: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 70: -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: <notice> [driver] ...command returned with exit code 0
Aug 24 16:32:42 RSP02 uv4l[435]: <notice> [driver] detected signal is 0x0, 0fps
Aug 24 16:32:42 RSP02 uv4l[435]: <error> [driver] no detected signal
Aug 24 16:32:42 RSP02 uv4l[435]: <error> [core] open() failed: no detected signal: Input/output error error: Input/output error
Aug 24 16:32:42 RSP02 uv4l[435]: <warning> [server] Input/output error
I hope you have a next idea :)

Is the 3B the last who work?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Aug 24, 2018 2:38 pm

Koda wrote:
Fri Aug 24, 2018 2:34 pm
Thank you

The new error is this

Code: Select all

sudo service uv4l_raspicam status
● uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-08-24 16:31:55 CEST; 49s ago
 Main PID: 435 (uv4l)
   CGroup: /system.slice/uv4l_raspicam.service
           └─435 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf

Aug 24 16:32:37 RSP02 uv4l[435]: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: 70: -- -- -- -- -- -- -- --
Aug 24 16:32:37 RSP02 uv4l[435]: <notice> [driver] ...command returned with exit code 0
Aug 24 16:32:42 RSP02 uv4l[435]: <notice> [driver] detected signal is 0x0, 0fps
Aug 24 16:32:42 RSP02 uv4l[435]: <error> [driver] no detected signal
Aug 24 16:32:42 RSP02 uv4l[435]: <error> [core] open() failed: no detected signal: Input/output error error: Input/output error
Aug 24 16:32:42 RSP02 uv4l[435]: <warning> [server] Input/output error
I hope you have a next idea :)

Is the 3B the last who work?
Please take debugging UV4L issues to a new thread - this one is bad enough to follow as it is, and is about kernel drivers.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Torna
Posts: 43
Joined: Thu Nov 24, 2011 8:59 pm

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

Wed Sep 26, 2018 3:53 pm

Hi everyone,

I was following 6by9 instruction here https://www.raspberrypi.org/forums/view ... 0#p1339178
It works well on a Pi3B+ with last version of Raspbian Strech with rpi-update.

I have now a really stupid question but from that, how can i record a simple video in mp4 format ?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Sep 26, 2018 4:33 pm

Torna wrote:
Wed Sep 26, 2018 3:53 pm
I was following 6by9 instruction here https://www.raspberrypi.org/forums/view ... 0#p1339178
It works well on a Pi3B+ with last version of Raspbian Strech with rpi-update.
You shouldn't need rpi-update these days - all the patches should be merged and released via "apt upgrade" by now, although I haven't checked.
Torna wrote:I have now a really stupid question but from that, how can i record a simple video in mp4 format ?
Same as raspivid - they both produce H264 elementary streams which have no timestamp information.
The modified Yavta does write out the frame timestamps to a file called file.pts, the same as "raspivid -pts file.pts" would. Use mkvmerge to combine the two.

Code: Select all

mkvmerge -o video.mkv --timecodes 0:file.pts video.h264
You can potentially use GStreamer or FFmpeg to work with V4L2 via v4l2src, but it'd need some checking and possibly patching. The TC358743 is ideally set to produce YUV422 data (it saves 50% of the bandwidth over RGB888, and the codec wants YUV420 anyway), and whilst the video_encode component will now accept that natively I'm not sure if the gst-omx components will allow it.
FFmpeg's support for the OMX video encoder is for I420 (YUV420 planar) only, so that certainly won't do it natively.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Torna
Posts: 43
Joined: Thu Nov 24, 2011 8:59 pm

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

Wed Sep 26, 2018 4:47 pm

Thank you very much for quick answer 6by9 :)

Well, i'm a bit confused. I mean, is there any way to directly get an mp4 file from /dev/video0 ?

Before your driver update i was using the bcm2835-v4l2 modules and ffmpeg compiled to support hardware acceleration with such a command :

Code: Select all

ffmpeg -f uv4l -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v copy -f mp4 video.mp4
It was working just fine. But now, if I understand it well, I can't do that. If so, is there any equivalent way ?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Sep 26, 2018 5:47 pm

Torna wrote:
Wed Sep 26, 2018 4:47 pm
Thank you very much for quick answer 6by9 :)

Well, i'm a bit confused. I mean, is there any way to directly get an mp4 file from /dev/video0 ?

Before your driver update i was using the bcm2835-v4l2 modules and ffmpeg compiled to support hardware acceleration with such a command :

Code: Select all

ffmpeg -f uv4l -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v copy -f mp4 video.mp4
It was working just fine. But now, if I understand it well, I can't do that. If so, is there any equivalent way ?
uv4l is a closed-source library supported by RpiName on these forums. Raspberry Pi are not involved in it at all.

bcm2835-v4l2 merges the CSI2 receiver, ISP, and video codec into one huge monolithic blob, and as it's almost all hidden down on the GPU people complain.

bcm2835-unicam is only controlling the CSI2 receiver to deliver buffers of raw pixel data. Any subsequent processing to alternate colour formats or encoding has to be constructed via the application.
My yavta fork is combining bcm2835-unicam, and the MMAL ISP and video encode components to deliver a similar pipeline to bcm2835-v4l2, however it can't directly write to an mp4 file (it's functionality I've thought about for raspivid for ages but never done).
FFmpeg and GStreamer are alternative applications for configuring pipelines, but I'm not sure they have all the required options for optimal performance.

As the frame rate of an HDMI source should be pretty stable you may be able to get away with the horrid hack of sending the output of yavta to stdout, and then reading the input into ffmpeg. The reason that it is a horrid hack is that it loses all timestamp information, so if there are any frame drops or variation in frame rate then the output file doesn't reflect them.
The camera delivers about 25.002fps if you ask for 25fps, so doing that you get a gradual drift over time, hence the need for timestamps.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Jacky Chen
Posts: 3
Joined: Thu Sep 27, 2018 8:08 am

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

Thu Sep 27, 2018 3:07 pm

Hi 6by9, I have a question about the frame rate control of MMAL lib. I want to know whether the MMAL lib have some ways to control the frame rate which fed into the input of encode component? The v4l2-ctl seems to provide a similar function.

For video transmission application, in some case, the raw video frame rate has to be decreased to meet the limited channel bandwidth.

Some kind of camera have fixed and unadjustable frame rate of hdmi output such as Gopro or other Brands. So some of raw video frame have to be abandoned before input of the h.264 encode component.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
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 Sep 27, 2018 3:58 pm

I got distracted today into looking at GStreamer.

4 patches added to https://github.com/6by9/gst-omx/tree/pi that add full support for RGB/BGR, ARGB/ABGR, and the YUYV family of formats to omxh264enc. It also includes the fixes for handling encoded buffer sizes more sensibly (GStreamer fell over and/or truncated buffers if an encoded frame exceeded one buffer otherwise - see https://www.raspberrypi.org/forums/view ... 9&t=200306).
Someone provided some nice instructions for building GStreamer from source at https://gist.githubusercontent.com/spha ... r-build.sh

You need to set the format manually on the V4L2 device.
"v4l2-ctl --query-dv-timings" will tell you the current mode.
"v4l2-ctl --list-dv-timings" will tell you all the supported modes, with index values on them.
"v4l2-ctl --set-dv-bt-timings index=X" will set mode with index X.
You can do it more simply in code (as yavta does), but not via v4l2-ctl.

With that

Code: Select all

gst-launch-1.0 -vvv -e v4l2src ! video/x-raw,format=UYVY,framerate=60/1 ! omxh264enc target-bitrate=2000000 control-rate=variable ! h264parse ! matroskamux ! filesink location=foo.mkv
should save an mkv file for your source.
GStreamer doesn't know how to handle the DV timings ioctls, hence having to be told the framerate. By default it was selecting 120fps for some reason, which the codec barfs at as 720P120 exceeds the defined level.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
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: 5805
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 Sep 27, 2018 4:07 pm

Jacky Chen wrote:
Thu Sep 27, 2018 3:07 pm
Hi 6by9, I have a question about the frame rate control of MMAL lib. I want to know whether the MMAL lib have some ways to control the frame rate which fed into the input of encode component? The v4l2-ctl seems to provide a similar function.
v4l2-ctl does? I can't see it with a quick look at the help text.

Anyway, it's a function of the app gluing things together, not MMAL itself. All the buffers will be dequeued from V4L2, and then the app chooses which to forward on to the MMAL resize/format convert/encode.
The one thing you can NOT do is to drop buffers of encoded H264 data as it uses temporal compression so the decoder has to be able to reconstruct all the frames that the encoder produced.
Jacky Chen wrote:For video transmission application, in some case, the raw video frame rate has to be decreased to meet the limited channel bandwidth.

Some kind of camera have fixed and unadjustable frame rate of hdmi output such as Gopro or other Brands. So some of raw video frame have to be abandoned before input of the h.264 encode component.
As long as you are looking at a dropping whole frames and not thinking you can do an arbitrary frame rate conversion, then fine.
Do remember though that the absolute maximum is 1080P50. If the source produces 1080P60 then there is no way to receive the data on a standard Pi (only on the CM with the B102 or similar board providing 4 lanes of CSI2 data).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

andes
Posts: 13
Joined: Tue Oct 09, 2018 3:41 am

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

Sun Oct 14, 2018 4:45 am

edited in the next post.....................
Last edited by andes on Tue Oct 16, 2018 3:29 am, edited 2 times in total.

andes
Posts: 13
Joined: Tue Oct 09, 2018 3:41 am

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

Tue Oct 16, 2018 2:04 am

Ok, what I have tried so far:
1> Reset my Pi 3B+ to get the newest kernel driver. My config.txt file as follow:

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
start_x=1
gpu_mem=256

#Enable TC358743 on B101
dtoverlay=tc358743
dtoverlay=tc358743-audio
2> Install yatva from 6by9's git repo

3> Wire the pins from B101 rev4 to GPIO pins
pin 5 = SD -> Pi GPIO20 PCM_DIN
pin 6 = SCK -> Pi GPIO18 PCM_CLK
pin 7 = WFS -> Pi GPIO19 PCM_FS

4> Test the audio output from B101:

Code: Select all

[email protected]:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Code: Select all

[email protected]:~ $ v4l2-ctl --list-ctrls

User Controls

            audio_sampling_rate (int)    : min=0 max=768000 step=1 default=0 value=0 flags=read-only
                  audio_present (bool)   : default=0 value=0 flags=read-only

Digital Video Controls

                  power_present (bitmask): max=0x00000001 default=0x00000000 value=0x00000001 flags=read-only
5> Try to record something, but got error and the recorded file is always 44B

Code: Select all

[email protected]:~ $ sudo arecord -D hw:1,0 -d 25 -f cd test1.wav
Recording WAVE 'test1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
arecord: pcm_read:2103: read error: Input/output error
Please anyone point me out where I did wrongly? Thanks

Return to “Graphics, sound and multimedia”