Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Thu Jul 11, 2019 3:51 pm

Hi everybody,

I just bought this card and wanted to grab video from a little camera giving out 1080px x 25 fps.

https://auvidea.eu/b101-hdmi-to-csi-2-b ... 5-pin-fpc/

I read that it is supported with raspivid so I innocently thought it would work like a charm... :D

but it looks more more complicated than I thought :shock: :oops:

I tried everything, but the best result are a moving white cloud on screen.

There is many topics on this thema, I was just wondering if you know a clean way to make it running ?

thank you very much in advance for your help

4flattires
Posts: 4
Joined: Sat Nov 18, 2017 6:47 am

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 3:46 am

Are you sure the pi shoving the video into that thing is doing it @ 25 FPS?

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 6:51 am

Hi tanks for the quick reply,

indeed my signal come from this things :

https://www.sentechamerica.com/En/Camer ... TC-HD203DV

I set it on 1080 25fps, so it should be ok

sometimes I get a white cloud, sometimes an beginning of image but it die fast (like with old RF TV during thunderstorm) :mrgreen:

I'm not far of the solution , I dont find the little last trick

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 7:16 am

I get suddenly a good image and it die, and dont show anything yet, impossible to understand why.

I double checked the ouput setting on a external monitor able to show 1080 @ 25 fps, It is sure it is ok, no doubt

Thank you in advance for your help and support.

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 7:19 am

concerning driver and co it should be ok, it is well recognized :

Code: Select all

[email protected]:~ $ v4l2-ctl --list-devices
bcm2835-codec (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

mmal service 16.1 (platform:bcm2835-v4l2):
	/dev/video0
so it should be ok, but not yet :roll: :D
Last edited by Aeluvidu on Fri Jul 12, 2019 8:29 am, edited 1 time in total.

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 8:28 am

I also tried the EDID tricks but I haven't found a good edid file for 25fps, so I tried with 30

I get this :

Code: Select all

v4l2-ctl --set-edid=file=1080P30EDID.txt --fix-edid-checksums
 
CTA-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

CTA-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
VIDIOC_S_EDID: failed: Inappropriate ioctl for device

And I get always the following and nothing on screen

Code: Select all

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

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

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 9:52 am

Aeluvidu wrote:
Fri Jul 12, 2019 8:28 am
And I get always the following and nothing on screen

Code: Select all

[email protected]:~ $ raspivid -f
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.
You will, specifically because the use of raspivid with the TC358743 chip is unsupported.

Code: Select all

[email protected]:~ $ v4l2-ctl --list-devices
bcm2835-codec (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

mmal service 16.1 (platform:bcm2835-v4l2):
	/dev/video0
...
I also tried the EDID tricks but I haven't found a good edid file for 25fps, so I tried with 30

I get this :

Code: Select all

v4l2-ctl --set-edid=file=1080P30EDID.txt --fix-edid-checksums
 
CTA-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

CTA-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
VIDIOC_S_EDID: failed: Inappropriate ioctl for device
mmal service 16.1 (platform:bcm2835-v4l2): is still the firmware drivers, therefore it has no idea over setting EDIDs.

Add "dtoverlay=tc358743" to /boot/config.txt on a Pi3 or 4, or "dtoverlay=tc358743,i2c_pins_28_29=1" on Pi 0/0W/B+/2.
You should then get

Code: Select all

[email protected]:~ $ v4l2-ctl --list-devices
bcm2835-codec (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

unicam (platform:unicam fe801000.csi):
	/dev/video0
(that's from a Pi4. The address will be different on other models).

That V4L2 device will accept setting the EDID, and indeed it will be a requirement unless you can force your source to produce some particular output.
"v4l2-ctl --query-dv-timings" will query the detected input parameters, and "v4l2-ctl --set-dv-bt-timings query" will select them as the desired timings to be used (you want to do this).

You now have a V4L2 device configured to receive the incoming HDMI data. Use your preferred V4L2 capture tool to receive the images.
Gstreamer 1.14 or later works pretty well. There is a small test app at https://github.com/6by9/yavta that connects the V4L2 source into the MMAL APIs, resulting in putting the received images on the screen and optionally H264 encoding them ("./yavta --capture=1000 -n 3 -f UYVY -m -T /dev/video0").

For more info, please read the thread at https://www.raspberrypi.org/forums/view ... 8&t=120702. Probably start around page 17 as early stuff was all about them adding a kernel driver for the chip, but without a CSI2 receiver driver it's useless.
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.

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 1:26 pm

@6by9 : thank you very much for your fast support it helps a lot :)

I had the following " dtoverlay=tc358743" to /boot/config.txt

I now get this :

Code: Select all

[email protected]:~/yavta $ v4l2-ctl --list-devices
bcm2835-codec (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12

unicam (platform:unicam 3f801000.csi):
	/dev/video0
That V4L2 device will accept setting the EDID, and indeed it will be a requirement unless you can force your source to produce some particular output.
"v4l2-ctl --query-dv-timings" will query the detected input parameters, and "v4l2-ctl --set-dv-bt-timings query" will select them as the desired timings to be used (you want to do this).
not sure I have understood it very well

I did :

Code: Select all

[email protected]:~ $ v4l2-ctl --set-edid=file=1080P30EDID.txt --fix-edid-checksums

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

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

Code: Select all

[email protected]:~/yavta $ v4l2-ctl --query-dv-timings
	Active width: 1920
	Active height: 1080
	Total width: 2640
	Total height: 1125
	Frame format: progressive
	Polarities: -vsync -hsync
	Pixelclock: 74250000 Hz (25.00 frames per second)
	Horizontal frontporch: 0
	Horizontal sync: 720
	Horizontal backporch: 0
	Vertical frontporch: 0
	Vertical sync: 45
	Vertical backporch: 0
	Standards: 
	Flags: 
and then

Code: Select all

[email protected]:~/yavta $ v4l2-ctl --set-dv-bt-timings query
BT timings set

and then I get with your sample code the followings :

Code: Select all

[email protected]:~/yavta $ ./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 74250000
Framerate is 25
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
vc.ril.isp:in:0(UYVY)(0xa14120)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 0xa1e198
Sent buffer 0xa1e370
Sent buffer 0xa1e548
Sent buffer 0xa1e720
Sent buffer 0xa1e8f8
Sent buffer 0xa1ead0
Sent buffer 0xa1eca8
Sent buffer 0xa1ee80
Unable to request buffers: Cannot allocate memory (12).
:?: :!: :?: :oops:

I still need your :idea:


Indeed after I would like to use my stream in a python openCV process
Do you know a way to grab it easily ?

in a perfect world as simple as

Code: Select all

self.capture = cv2.VideoCapture(0)
?

Thank you very much in advance for your feedback

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

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 1:45 pm

Aeluvidu wrote:
Fri Jul 12, 2019 1:26 pm

Code: Select all

[email protected]:~/yavta $ ./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 74250000
Framerate is 25
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
vc.ril.isp:in:0(UYVY)(0xa14120)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 0xa1e198
Sent buffer 0xa1e370
Sent buffer 0xa1e548
Sent buffer 0xa1e720
Sent buffer 0xa1e8f8
Sent buffer 0xa1ead0
Sent buffer 0xa1eca8
Sent buffer 0xa1ee80
Unable to request buffers: Cannot allocate memory (12).
:?: :!: :?: :oops:

I still need your :idea:
Edit /boot/cmdline.txt and add "cma=128" to the start of the line.

Aeluvidu wrote:Indeed after I would like to use my stream in a python openCV process
Do you know a way to grab it easily ?

in a perfect world as simple as

Code: Select all

self.capture = cv2.VideoCapture(0)
?

Thank you very much in advance for your feedback
If you wish to cripple performance, then use OpenCV. It's great as a generalised processing framework, but is terrible on any form of optimisation. Insisting on RGB for everything is the first major headache.
It should work, but don't expect to be able to do anything at 1080p 25fps.
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.

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 2:18 pm

Edit /boot/cmdline.txt and add "cma=128" to the start of the line.

then a reboot and it works !!!!!!!!!!!!!!!!!!!!!!!

YESSSSSS thank you so much @ 6by9 ! :) :) :) :) :) :) :) :)


détails, it works once, if I close the application, I have to restart, I think I have to do the trick with the reset and the gpio 3 to reset the B101 2 CSI

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 2:21 pm

concerning openCV, it is true it slow down the things, but it is so userfriendly to draw on image ans so on, which alternative do you propose indeed ? :?:

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

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 2:34 pm

Aeluvidu wrote:
Fri Jul 12, 2019 2:18 pm
détails, it works once, if I close the application, I have to restart, I think I have to do the trick with the reset and the gpio 3 to reset the B101 2 CSI
Pass. It works fine for me on with a B101, and it's not a Raspberry Pi product that we directly support.
The kernel drivers are different from the firmware in that it keeps the chip powered up the whole time, whilst the firmware reinitialises it every time you run raspivid.
Aeluvidu wrote:
Fri Jul 12, 2019 2:21 pm
concerning openCV, it is true it slow down the things, but it is so userfriendly to draw on image ans so on, which alternative do you propose indeed ? :?:
Userfriendly and efficient tend to be opposites. Prototype in OpenCV, and then optimise when you have it working.
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.

Aeluvidu
Posts: 9
Joined: Thu Jul 11, 2019 3:42 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 12, 2019 3:11 pm

@6by9 : thanks a lot again for your help ! have a nice wk

Noahl
Posts: 3
Joined: Wed Jul 17, 2019 5:46 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Wed Jul 17, 2019 6:35 pm

@6by9 Hi, I'm also trying to get this module working on my 3B+. I think I need to do the reset on the chip, but I'm confused as to how I'm suppose to do this. I read something about pin 133 being used for CAM_GPIO or something in a similar post. I'm just lost at what to do with it. I've followed the step listed in this post, and am getting similar results as the OP. But it either stops when I use the command:

./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0

It either ends with a segmentation fault, or unable to allocate memory.

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

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Fri Jul 19, 2019 11:19 am

Noahl wrote:
Wed Jul 17, 2019 6:35 pm
@6by9 Hi, I'm also trying to get this module working on my 3B+. I think I need to do the reset on the chip, but I'm confused as to how I'm suppose to do this. I read something about pin 133 being used for CAM_GPIO or something in a similar post. I'm just lost at what to do with it. I've followed the step listed in this post, and am getting similar results as the OP. But it either stops when I use the command:

./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0

It either ends with a segmentation fault, or unable to allocate memory.
Why are you trying to reset the chip? With the V4L2 driver the state is retained between runs, and is only fully initialised when the driver module is loaded (typically once per boot).
If you're unable to allocate memory, then have you increased the size of the cma heap?
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.

Noahl
Posts: 3
Joined: Wed Jul 17, 2019 5:46 pm

Re: B101 HDMI to CSI-2 Bridge (15 pin FPC) - how to make it run ?

Sat Jul 20, 2019 5:52 am

6by9 wrote:
Noahl wrote:
Wed Jul 17, 2019 6:35 pm
@6by9 Hi, I'm also trying to get this module working on my 3B+. I think I need to do the reset on the chip, but I'm confused as to how I'm suppose to do this. I read something about pin 133 being used for CAM_GPIO or something in a similar post. I'm just lost at what to do with it. I've followed the step listed in this post, and am getting similar results as the OP. But it either stops when I use the command:

./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0

It either ends with a segmentation fault, or unable to allocate memory.
Why are you trying to reset the chip? With the V4L2 driver the state is retained between runs, and is only fully initialised when the driver module is loaded (typically once per boot).
If you're unable to allocate memory, then have you increased the size of the cma heap?
Hi, I was able to get it working. I was re-reading some other pages about it and saw that adding "cma=32M" instead of "cma=128" works. I changed it and can now view hdmi input from the board using VLC just to check. I was feeding another pi's input into the B101 board so that's a good start. Thank you.

Return to “Interfacing (DSI, CSI, I2C, etc.)”