Difference between revisions of "HDMI to CSI Adapter"

From Waveshare Wiki
Jump to: navigation, search
(Created page with "{{infobox item| |img=400px|alt=HDMI to CSI|link=https://www.waveshare.com/hdmi-to-csi-adapter.htm |caption=HDMI To CSI Adapter For Raspberry...")
 
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<div class="wiki-pages jet-green-color">
 
{{infobox item|
 
{{infobox item|
|img=[[File:HDMI-to-CSI-Adapter-1.jpg|400px|alt=HDMI to CSI|link=https://www.waveshare.com/hdmi-to-csi-adapter.htm]]
+
|img=[[File:HDMI-to-CSI-Adapter-1.jpg|400px|alt=HDMI to CSI|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/hdmi-to-csi-adapter.htm}}]]
 
|caption=HDMI To CSI Adapter For Raspberry Pi Series, [email protected] Support
 
|caption=HDMI To CSI Adapter For Raspberry Pi Series, [email protected] Support
 
|category=[[:Category:Raspberry Pi|Raspberry Pi]]
 
|category=[[:Category:Raspberry Pi|Raspberry Pi]]
 
|brand=Waveshare
 
|brand=Waveshare
|{{#urlget:amazon|default}}=display
+
|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display
 
|website_cn=[http://www.waveshare.net 微雪电子]
 
|website_cn=[http://www.waveshare.net 微雪电子]
 
|website_en=[https://www.waveshare.com/hdmi-to-csi-adapter.htm Website]
 
|website_en=[https://www.waveshare.com/hdmi-to-csi-adapter.htm Website]
Line 10: Line 11:
 
<div class="tabber">
 
<div class="tabber">
 
<div class="tabbertab" title="Introduction">
 
<div class="tabbertab" title="Introduction">
==Overview==
+
==Introduction==
 
This is an HDMI to CSI camera port adapter designed for Raspberry Pi with up to [email protected] support from HDMI input, backward compatible. It allows you to use HDMI cameras just as the standard Raspberry Pi CSI cameras, all versions of Raspberry Pi series boards are supported.
 
This is an HDMI to CSI camera port adapter designed for Raspberry Pi with up to [email protected] support from HDMI input, backward compatible. It allows you to use HDMI cameras just as the standard Raspberry Pi CSI cameras, all versions of Raspberry Pi series boards are supported.
 +
==Parameters==
 +
*Controller: TC358743XBG
 +
*Input signal:
 +
**Video: HDMI1.4, RGB888, supports up to [email protected]
 +
**Audio: HDMI audio
 +
*Output signal:
 +
**Video: 2 lanes MIP CSI-2
 +
**Audio: I2S audio output, LPCM format
 +
*OS: Raspberry Pi OS
 +
*Working voltage: 3.3V
 +
*Working temperature: -30° ~ 70°C
 
==Connection==
 
==Connection==
 +
; Video:
 
:[[File:HDMI-to-CSI-Adapter-details-3.jpg|800px]]
 
:[[File:HDMI-to-CSI-Adapter-details-3.jpg|800px]]
Connect the FPC cable of Raspberry Pi to the CSI interface of Raspberry Pi. The CSI interface of Pi 2B, 3B, 3B+ located between the LAN port and HDMI port. The CSI interface of Pi 4 is placed between the HDMI1 interface and the audio jack. If you use Pi zero, the CSI interface is beside the Power port. Here is the diagram of Pi 4. 4B<br />
+
Connect the FPC cable of Raspberry Pi to the CSI interface of Raspberry Pi. The CSI interface of Pi 2B, 3B, 3B+ is located between the LAN port and HDMI port. The CSI interface of Pi 4 is placed between the HDMI1 interface and the audio jack. If you use Pi zero, the CSI interface is beside the Power port. Here is the diagram of Pi 4. 4B<br />
 
[[File:HDMI-to-CSI-Adapter-details-7.jpg|800px]]<br />
 
[[File:HDMI-to-CSI-Adapter-details-7.jpg|800px]]<br />
Note that the silver side (metal side) should toward to the HDMI interface. Release the black buckle, align the FPC cable and insert it tightly, then close the black buckle.
+
Note that the silver side (metal side) should be toward the HDMI interface. Release the black buckle, align the FPC cable and insert it tightly, then close the black buckle.
;2. Enable Camera
+
; Audio
The camera interface of Raspberry Pi is default disabled. Before you use camera, you should enable it.<br />
+
To use the audio, you need to jumper wire the following gpio to the I2S pins of the Raspberry Pi board.
Open Raspberry Pi terminal and excute command sudo raspi-config, then choose Interfacing Options -> Camera -> Yes<br />
+
{|class="wikitable"
[[File:Camera-Scheduler-manual-2.jpg|500px]]&nbsp;&nbsp;
+
! HDMI to CSI !! Raspberry Pi
[[File:Camera-Scheduler-manual-3.jpg|500px]]<br /><br />
+
|-
[[File:Camera-Scheduler-manual-4.jpg|500px]]&nbsp;&nbsp;
+
|WFS || GPIO19
[[File:Camera-Scheduler-manual-5.jpg|500px]]<br /><br />
+
|-
Reboot Raspberry Pi
+
|SCK || GPIO18
 +
|-
 +
|SD || GPIO20
 +
|-
 +
|GND|| GND
 +
|}
 +
==Software Setup==
 +
<!--
 +
=== Method 1. Enable Lagence camera===
 +
*Open Raspberry Pi terminal and update.
 +
<pre>
 +
sudo apt-get update
 +
</pre>
 +
*Enable Legacy camera.
 +
<pre>
 +
sudo raspi-config
 +
</pre>
 +
*Choose Interface Options -> Legacy Camera Enable -> Yes.
 +
*Reboot.
 +
<pre>
 
  sudo reboot
 
  sudo reboot
;3. Test
+
</pre>
: Open a terminal and test the adapter
+
*Test the adapter with the following command.
:'''Capture''':sudo raspistill -o image-01.jpg
+
<pre>
:'''Record''':sudo raspivid -o video-01.h264 -t 10000
+
sudo raspivid -t 0
:[[File:HDMI-to-CSI-Adapter-details-5.jpg|800px]]
+
</pre>
 +
 
 +
===Methord 2: Use V4l2===
 +
*Add the following line to /boot/config.txt file
 +
; For Pi3, Pi 4 or Pi zero
 +
<pre>
 +
dtoverlay=tc358743
 +
</pre>
 +
; For CM4
 +
<pre>
 +
dtoverlay=tc358743,4lane=1
 +
</pre>
 +
*If you need to use audio function, please add the following line as well (optional)
 +
<pre>
 +
dtoverlay=tc358743-audio
 +
</pre>
 +
*Add the following content to /boot/cmdline.txt (Note that do not append new line to the file, just add it)
 +
<pre>
 +
cma=96M
 +
</pre>
 +
*Download the scirpt to Raspberry Pi and install it.
 +
<pre>
 +
cd
 +
wget https://www.waveshare.com/w/upload/8/89/TC358743-Driver.zip
 +
cd ~/TC358743-Driver
 +
sudo sh set_edit.sh
 +
</pre>
 +
*Rebot the Pi
 +
<pre>
 +
sudo reboot
 +
</pre>-->
 +
Note: HDMI to CSI camera does not support Libcamera driver.<br/>
 +
*Modify config.txt file
 +
sudo nano /boot/config.txt
 +
Add the following sentences to the end of the file.<br/>
 +
<pre>
 +
dtoverlay=tc358743
 +
dtoverlay=tc358743-audio
 +
</pre>
 +
Save the file.<br/>
 +
*Modify cmdline.txt
 +
sudo nano /boot/cmdline.txt
 +
add the following content to the file <br/>
 +
cma=96M
 +
*Download and install the driver demo. 
 +
<pre>
 +
cd
 +
wget https://www.waveshare.com/w/upload/8/89/TC358743-Driver.zip
 +
unzip TC358743-Driver.zip
 +
cd ~/TC358743-Driver
 +
sudo sh set_edid.sh
 +
</pre>
 +
*Reboot the system.
 +
sudo reboot
 +
==Test the video==
 +
'''yavta'''<br/>
 +
<pre>
 +
cd ~/TC358743-Driver/yavta/yavta/
 +
./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY –m -T /dev/video0
 +
</pre>
 
</div>
 
</div>
<div class="tabbertab" title="Resources">
+
: The codes will capture 100 framerates and save them to file.h264 file, you can use vlc tool to play the file
 +
'''gstreamer'''<br/>
 +
*Install the tool
 +
<pre>sudo apt install gstreamer1.0-tools -y</pre>
 +
*Collect  video:
 +
<pre>
 +
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=30/1,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=file.mkv
 +
</pre>
  
 +
==Recording==
 +
*Check the audio devices with '''arecord -l''' command.
 +
<pre>
 +
**** List of CAPTURE Hardware Devices ****
 +
card 2: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0
 +
[bcm2835-i2s-dir-hifi dir-hifi-0]
 +
Subdevices: 1/1
 +
Subdevice #0: subdevice #0
 +
</pre>
 +
:Note: Card 2 is the ID of the soundcard
 +
*Record the audio and save it as wav file
 +
<pre>arecord -D hw:2 -d 25 -f cd test1.wav</pre>
 +
Note: where hw:2 is to set the sound card device, it needs to match the actual sound card number, otherwise the audio information cannot be collected normally.
 +
=Resources=
 +
==Driver==
 +
*[https://www.waveshare.com/w/upload/8/89/TC358743-Driver.zip Driver for HMDI to CSI Adapter]
 
</div>
 
</div>
 
<div class="tabbertab" title="FAQ"><br />
 
<div class="tabbertab" title="FAQ"><br />

Latest revision as of 05:53, 28 November 2022

HDMI to CSI Adapter
HDMI to CSI

HDMI To CSI Adapter For Raspberry Pi Series, [email protected] Support
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

This is an HDMI to CSI camera port adapter designed for Raspberry Pi with up to [email protected] support from HDMI input, backward compatible. It allows you to use HDMI cameras just as the standard Raspberry Pi CSI cameras, all versions of Raspberry Pi series boards are supported.

Parameters

  • Controller: TC358743XBG
  • Input signal:
  • Output signal:
    • Video: 2 lanes MIP CSI-2
    • Audio: I2S audio output, LPCM format
  • OS: Raspberry Pi OS
  • Working voltage: 3.3V
  • Working temperature: -30° ~ 70°C

Connection

Video
HDMI-to-CSI-Adapter-details-3.jpg

Connect the FPC cable of Raspberry Pi to the CSI interface of Raspberry Pi. The CSI interface of Pi 2B, 3B, 3B+ is located between the LAN port and HDMI port. The CSI interface of Pi 4 is placed between the HDMI1 interface and the audio jack. If you use Pi zero, the CSI interface is beside the Power port. Here is the diagram of Pi 4. 4B
HDMI-to-CSI-Adapter-details-7.jpg
Note that the silver side (metal side) should be toward the HDMI interface. Release the black buckle, align the FPC cable and insert it tightly, then close the black buckle.

Audio

To use the audio, you need to jumper wire the following gpio to the I2S pins of the Raspberry Pi board.

HDMI to CSI Raspberry Pi
WFS GPIO19
SCK GPIO18
SD GPIO20
GND GND

Software Setup

Note: HDMI to CSI camera does not support Libcamera driver.

  • Modify config.txt file
sudo nano /boot/config.txt

Add the following sentences to the end of the file.

dtoverlay=tc358743
dtoverlay=tc358743-audio

Save the file.

  • Modify cmdline.txt
sudo nano /boot/cmdline.txt

add the following content to the file

cma=96M
  • Download and install the driver demo.
cd
wget https://www.waveshare.com/w/upload/8/89/TC358743-Driver.zip
unzip TC358743-Driver.zip
cd ~/TC358743-Driver
sudo sh set_edid.sh
  • Reboot the system.
sudo reboot

Test the video

yavta

cd ~/TC358743-Driver/yavta/yavta/
./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY –m -T /dev/video0
The codes will capture 100 framerates and save them to file.h264 file, you can use vlc tool to play the file

gstreamer

  • Install the tool
sudo apt install gstreamer1.0-tools -y
  • Collect video:
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,framerate=30/1,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=file.mkv

Recording

  • Check the audio devices with arecord -l command.
**** List of CAPTURE Hardware Devices ****
card 2: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0
[bcm2835-i2s-dir-hifi dir-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0 
Note: Card 2 is the ID of the soundcard
  • Record the audio and save it as wav file
arecord -D hw:2 -d 25 -f cd test1.wav

Note: where hw:2 is to set the sound card device, it needs to match the actual sound card number, otherwise the audio information cannot be collected normally.

Resources

Driver



Support

If you require technical support, please go to the Support page and open a ticket.