HDMI to CSI Adapter

From Waveshare Wiki
Jump to: navigation, search
HDMI to CSI Adapter
HDMI to CSI

HDMI To CSI Adapter For Raspberry Pi Series, 1080p@30fps Support
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Introduction

This is a Raspberry Pi expansion module that converts HDMI signals to CSI signals. It supports HDMI input up to 1080p 30fps and is 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.

Specifications

  • Controller: TC358743XBG
  • Input signal:
    • Video: HDMI1.4, RGB888, up to 1080p@30fps support
    • Audio: HDMI
  • Output signal:
    • Video: 2-lane MIP CSI-2
    • Audio: I2S audio output, LPCM audio stream format

OS: Raspberry Pi OS

  • Operating voltage: 3.3V
  • Operating temperature: -30° ~ 70°C

Hardware Connection

  • Video:

Insert the FPC cable of the adapter into the CSI port. If it is a Pi 2B, 3B, or 3B+, the CSI port is located between the network port and the HDMI interface. If it is a Pi 4B, the CSI port is located between the HDMI 1 interface and the audio interface. If it is a Pi Zero, the CSI port is located on the side of the power port. Note that the silver side (metal side) of the cable should face the HDMI port. Unfasten the black button of the cable slot away and insert the cable. The cable needs to be fully inserted into the slot, be careful to avoid bending the cable while ensuring it is plugged in tightly, and then fasten the black button.

HDMI-to-CSI-Adapter-details-3.jpg
HDMI-to-CSI-Adapter-details-7.jpg
  • Audio

To connect the audio, the user needs to prepare the cable separately and do the soldering. Connect the pad reserved on the HDMI to CSI side to the I2S pin of Raspberry Pi as shown in the following diagram.

HDMI to CSI Raspberry Pi
WFS (PIN35)GPIO19
SCK (PIN12)GPIO18
SD (PIN38)GPIO20
GND GND

Software Settings

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

  • modify config.txt file
sudo nano /boot/config.txt
Add the following statement to the file
dtoverlay=tc358743
dtoverlay=tc358743-audio
Save the file
  • Modify the cmdline.txt file
sudo nano /boot/cmdline.txt

Add the following content to the file

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

Test Video

Capture video with yavta
  • Connect the device
  • Enter the demo directory and run it
cd ~/TC358743-Driver/yavta/yavta/
sudo make clean
make
./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0

The demo will capture 1000 frames of images and save them as a file.h264 file

Capture video with gstreamer
  • Install gstreamer tool
sudo apt install gstreamer1.0-tools -y
  • Capture 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

Extend Computer Screen to Raspberry Pi

If you use this feature, you need to delete dtoverlay=tc358743 and dtoverlay=tc358743-audio configurations. Only the following configuration should be done. Currently, it only supports 720p

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

Add the following content to the file

cma=96M

Save it

  • Then do the following to open legacy camera
sudo raspi-config

Select Interface Options -> Legacy Camera -> Yes, exit, and then reboot.

  • Boot the terminal to run
raspivid -t 0

Test Audio

  • Run the arecord-l command to check, and the tc358743 device will be recognized normally, for example:
**** 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: Here, card 2 is the ID of the sound card, which will be used in subsequent audio recording.

  • Record the audio and save it as a 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 ID, otherwise the audio information cannot be collected normally.

Capture Video with Raspberry Pi 5

Note: Due to system version limitations, there is currently a frame drop problem in the collection

Hardware Connection

Plug the FPC cable of the HDMI to CSI module into the CSI Camera 1 port of the Raspberry Pi 5, and insert the metal contacts in the direction of the network port when plugging in the cable. The HDMI interface needs to be connected to an HDMI-connected device to capture normally.
In addition, the HDMI output device needs to support the corresponding resolution in order to work properly.

Operation Steps

  • Turn on the computer, open the terminal, input the command to edit the configuration file
sudo nano /boot/firmware/config.txt 
  • Add the following content at the end of the file, press Ctrl + Y and then Enter to save:
dtoverlay=tc358743
  • Download the EDID file and unzip it:
wget https://files.waveshare.com/wiki/HDMI_to_CSI_Adapter/Hdmi_to_csi_driver.zip
unzip Hdmi_to_csi_driver.zip
  • Reboot the system
sudo reboot
  • Use the following commands to capture video:
cd hdmi_to_csi_driver/
v4l2-ctl --list-devices

Note: The device node for "rp1-cfe" in the above output is "/dev/media0". If you encounter a different ID, you need to make corresponding modifications.
HDMI-To-CSI-Adapter-pi5-1.png

  • The following takes 1280x720p60 as an example to configure (currently supports 720P60 and 1080P30)
v4l2-ctl -d /dev/v4l-subdev2 --set-edid=file=720p60edid
v4l2-ctl -d /dev/v4l-subdev2 --set-dv-bt-timings query

HDMI-To-CSI-Adapter-pi5-2.png

  • Configure interface
media-ctl -d /dev/media0 –r
media-ctl -d /dev/media0 -l ''\''csi2'\'':4 -> '\''rp1-cfe-csi2_ch0'\'':0 [1]'
media-ctl -d /dev/media0 -V ''\''csi2'\'':0 [fmt:RGB888_1X24/1280x720 field:none colorspace:srgb]'
media-ctl -d /dev/media0 -V ''\''csi2'\'':4 [fmt:RGB888_1X24/1280x720 field:none colorspace:srgb]'
v4l2-ctl -v width=1280,height=720,pixelformat=RGB3

900px-HDMI-To-CSI-Adapter-pi5-3.png

  • If the above steps are performed correctly, you can now capture HDMI video. Test if it is working with the following command:
v4l2-ctl --stream-mmap=3 --stream-count=1000 --stream-to=/dev/null

HDMI-To-CSI-Adapter-pi5-4.png

  • Capture video to file
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat='RGB3' --stream-mmap=4 --stream-skip=3 --stream-count=2 --stream-to=hc1xx.rgb --stream-poll

900px-HDMI-To-CSI-Adapter-pi5-5.png

  • Play the generated file with the built-in tool ffplay
ffplay -f rawvideo -video_size 1280x720 -pixel_format bgr24 hc1xx.rgb

900px-HDMI-To-CSI-Adapter-pi5-6.png

FAQ

 Answer:

Currently, it does not support Raspberry Pi 5.

{{{5}}}



 Answer:

The consumption of the adapter is about 260mA.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)