2021-05-24
CM4 on CM4IO with Auvidea B102 try 2
These accompany the forum topic CM4 on CM4IO with Auvidea B102 play dead try 2.
Pages with videos are named by original video timestamps, i.e. 210525-1543 is short for 2021-05-25-15:43 and so on.
This section is related to a new sibling of the topic CM4 on CM4IO with Auvidea B102 play dead which I am yet to hopefully create on Raspberry Pi forum.
As in the pictures at:
Fri May 21, 2021 4:52 pm post except not the CM4-eMMC but CM4-lite is what I use now.
So the case is as per these:
210522-1531
210522-1558
210522-1559
(these are from the
rpi-CM4 page of four days ago).
But I'm only trying to get going this hopefully working setup, i.e. all the same, but with CM4-lite instead of the CM4-eMMC.
And so I followed this guide:
TC358743 HDMI to CSI-2 install instructions
My /boot/config.txt, the three last lines:
dtoverlay=dwc2,dr_mode=host dtoverlay=tc358743,4lane=1 dtoverlay=tc358743-audio
The former allows me to attach RPI-keyboard and its mouse, the latter two should get me the video and audio.
Rebooting gets me the /dev/video device:
crw-rw----+ 1 root video 81, 7 May 23 17:56 /dev/video0
I downloaded the EDID file: 1080P50EDID.txt.
And this is what the commands from the guide got me:
$ v4l2-ctl --set-edid=file=Downloads/1080P50EDID.txt 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 $
$ v4l2-ctl --query-dv-timings Active width: 1920 Active height: 1080 Total width: 2640 Total height: 1125 Frame format: progressive Polarities: -vsync -hsync Pixelclock: 148500000 Hz (50.00 frames per second) Horizontal frontporch: 0 Horizontal sync: 720 Horizontal backporch: 0 Vertical frontporch: 0 Vertical sync: 45 Vertical backporch: 0 Standards: Flags: $
$ v4l2-ctl --set-dv-bt-timings query VIDIOC_QUERY_DV_TIMINGS: failed: No locks available VIDIOC_S_DV_TIMINGS: failed: Numerical result out of range $
However, on second try:
$ v4l2-ctl --query-dv-timings Active width: 1920 Active height: 1080 Total width: 2640 Total height: 1125 Frame format: progressive Polarities: -vsync -hsync Pixelclock: 148500000 Hz (50.00 frames per second) Horizontal frontporch: 0 Horizontal sync: 720 Horizontal backporch: 0 Vertical frontporch: 0 Vertical sync: 45 Vertical backporch: 0 Standards: Flags: $ v4l2-ctl --set-dv-bt-timings query BT timings set $
$ v4l2-ctl -V Format Video Capture: Width/Height : 1920/1080 Pixel Format : 'RGB3' (24-bit RGB 8-8-8) Field : None Bytes per Line : 5760 Size Image : 6220800 Colorspace : sRGB Transfer Function : Default (maps to sRGB) YCbCr/HSV Encoding: Default (maps to ITU-R 601) Quantization : Default (maps to Full Range) Flags : $
$ v4l2-ctl -v pixelformat=UYVY $ v4l2-ctl -V Format Video Capture: Width/Height : 1920/1080 Pixel Format : 'UYVY' (UYVY 4:2:2) Field : None Bytes per Line : 3840 Size Image : 4147200 Colorspace : SMPTE 170M Transfer Function : Default (maps to Rec. 709) YCbCr/HSV Encoding: Default (maps to ITU-R 601) Quantization : Default (maps to Limited Range) Flags : $
Pls. note the "No video detected" below:
v4l2-ctl --log-status =-=-=-=-=-= Status Log: [ 9376.359737] unicam fe801000.csi: ================= START STATUS ================= [ 9376.361387] tc358743 10-000f: -----Chip status----- [ 9376.363622] tc358743 10-000f: Chip ID: 0x00 [ 9376.364254] tc358743 10-000f: Chip revision: 0x00 [ 9376.364262] tc358743 10-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0 [ 9376.364269] tc358743 10-000f: Sleep mode: off [ 9376.364275] tc358743 10-000f: Cable detected (+5V power): yes [ 9376.364808] tc358743 10-000f: DDC lines enabled: yes [ 9376.365375] tc358743 10-000f: Hotplug enabled: yes [ 9376.365995] tc358743 10-000f: CEC enabled: no [ 9376.366002] tc358743 10-000f: -----Signal status----- [ 9376.366008] tc358743 10-000f: TMDS signal detected: no [ 9376.366015] tc358743 10-000f: Stable sync signal: no [ 9376.366021] tc358743 10-000f: PHY PLL locked: no [ 9376.366027] tc358743 10-000f: PHY DE detected: yes [ 9376.366550] tc358743 10-000f: No video detected [ 9376.366561] tc358743 10-000f: Configured format: 1920x1080p50.00 (2640x1125) [ 9376.366568] tc358743 10-000f: horizontal: fp = 0, -sync = 720, bp = 0 [ 9376.366575] tc358743 10-000f: vertical: fp = 0, -sync = 45, bp = 0 [ 9376.366581] tc358743 10-000f: pixelclock: 148500000 [ 9376.366588] tc358743 10-000f: flags (0x0): [ 9376.366595] tc358743 10-000f: standards (0x0): [ 9376.366601] tc358743 10-000f: -----CSI-TX status----- [ 9376.366608] tc358743 10-000f: Lanes needed: 2 [ 9376.366614] tc358743 10-000f: Lanes in use: 2 [ 9376.367224] tc358743 10-000f: Waiting for particular sync signal: no [ 9376.367832] tc358743 10-000f: Transmit mode: no [ 9376.368441] tc358743 10-000f: Receive mode: no [ 9376.369049] tc358743 10-000f: Stopped: no [ 9376.369056] tc358743 10-000f: Color space: YCbCr 422 16-bit [ 9376.369575] tc358743 10-000f: -----HDMI status----- [ 9376.369581] tc358743 10-000f: HDCP encrypted content: no [ 9376.369588] tc358743 10-000f: Input color space: RGB limited range [ 9376.370107] tc358743 10-000f: AV Mute: on [ 9376.370626] tc358743 10-000f: Deep color mode: 8-bits per channel [ 9376.373103] tc358743 10-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13 [ 9376.373111] tc358743 10-000f: colorspace: RGB [ 9376.373118] tc358743 10-000f: scan mode: Overscan [ 9376.373124] tc358743 10-000f: colorimetry: ITU709 [ 9376.373131] tc358743 10-000f: picture aspect: 16:9 [ 9376.373138] tc358743 10-000f: active aspect: Same as Picture [ 9376.373145] tc358743 10-000f: itc: No Data [ 9376.373151] tc358743 10-000f: extended colorimetry: xvYCC 601 [ 9376.373158] tc358743 10-000f: quantization range: Limited [ 9376.373165] tc358743 10-000f: nups: Unknown Non-uniform Scaling [ 9376.373172] tc358743 10-000f: video code: 31 [ 9376.373179] tc358743 10-000f: ycc quantization range: Limited [ 9376.373186] tc358743 10-000f: hdmi content type: Graphics [ 9376.373192] tc358743 10-000f: pixel repeat: 0 [ 9376.373200] tc358743 10-000f: bar top 0, bottom 0, left 0, right 0 [ 9376.373207] unicam fe801000.csi: -----Receiver status----- [ 9376.373214] unicam fe801000.csi: V4L2 width/height: 1920x1080 [ 9376.373220] unicam fe801000.csi: Mediabus format: 0000200f [ 9376.373227] unicam fe801000.csi: V4L2 format: 59565955 [ 9376.373233] unicam fe801000.csi: Unpacking/packing: 0 / 0 [ 9376.373239] unicam fe801000.csi: ----Live data---- [ 9376.373246] unicam fe801000.csi: Programmed stride: 0 [ 9376.373252] unicam fe801000.csi: Detected resolution: 0x0 [ 9376.373259] unicam fe801000.csi: Write pointer: 00000000 [ 9376.373265] unicam fe801000.csi: ================== END STATUS ==================
But here's a script, because I got tired of running these by hand. I had to run the script quite a few times as well, because I do have issues that I don't know how to deal with:
echo "v4l2-ctl --set-edid=file=Downloads/1080P50EDID.txt" v4l2-ctl --set-edid=file=Downloads/1080P50EDID.txt read NOOP echo "v4l2-ctl --query-dv-timings; sleep 1.5; v4l2-ctl --set-dv-bt-timings query; sleep 1.5" read NOOP v4l2-ctl --query-dv-timings; sleep 1.5 v4l2-ctl --set-dv-bt-timings query; sleep 1.5 echo "v4l2-ctl -V" read NOOP v4l2-ctl -V echo "v4l2-ctl -v pixelformat=UYVY" read NOOP v4l2-ctl -v pixelformat=UYVY v4l2-ctl -V echo "v4l2-ctl --log-status" read NOOP v4l2-ctl --log-status >> v4l2-ctl--log-status_$(date +%y%m%d_%H%M%S)
I saved it as /usr/local/bin/CM4_Auvidea_B102_setup.sh. (Do$ chmod 755 /usr/local/bin/CM4_Auvidea_B102_setup.sh and you can run it on command line, like$ CM4_Auvidea_B102_setup.sh.)
And regarding the audio:
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
And now I tried to get the video recorded.
I'm much more familiar with FFmpeg than gstreamer, so here's the command that should have worked:
ffmpeg -f v4l2 -input_format uyvy422 -probesize 12M \ -s 1920x1080 -i /dev/video0 -b:v 256k -f mpegts \ EuroNews_$(date +%y%m%d_%H%M).ts
But instead, it got me just a few frames from the source (pls. download):
EuroNews_210524_1818.ts
You can also view the FFmpeg's log of the try:
EuroNews_210524_1818_ffmpeg.log.
That's just one of many tries.
So I thought, let me try ustreamer.
Here's the command that I constructed to get me less typing for the many tries. I would, say, just change ll=2 to ll=1 to get less logging. This is on my SOHO, which is something equivalent to: 192.168.5.0/24.
The read NOOP is just to give a pause to see how the script fares, it isn't supposed to do anything. I'm also inserting newlines for readability, but I actually run it all on one line.
ll=2; echo log-level set to: $ll; read NOOP;
ts=$(date +%y%m%d_%H%M);
touch ustreamer_${ts}.log ;
ustreamer/ustreamer -m UYVY -n -s 192.168.5.103 \
-r 1920x1080 -t --log-level $ll \
|& tee ustreamer_${ts}.log
The |& tee is redirection to ustreamer_${ts}.log. To see what ts=$(date +%y%m%d_%H%M); does, run it in a terminal.
Once the ustreamer got going, I ran from elsewhere on my SOHO:
ffmpeg -i http://192.168.5.103:8080/stream \ -thread_queue_size 256 -r 50 -f alsa -i hw:0 \ -s 1920x1080 -b:v 2048k \ EuroNews_$(date +%y%m%d_%H%M)_ffmpeg-from-ustreamer.ts \ |& tee EuroNews_$(date +%y%m%d_%H%M)_ffmpeg-from-ustreamer.log
And these got me (pls. download/view):
EuroNews_210524_1809_ffmpeg-from-ustreamer.ts
EuroNews_210524_1809_ffmpeg-from-ustreamer.log
I also post two log-status logs, that show the same now you see me, now you don't differences btwn them:
v4l2-ctl--log-status_210524_180752
v4l2-ctl--log-status_210524_180836
Both have the No video detected line and many other info that I currently have very little if any understanding of.
Have I forgotten any details?
We'll know as I ask for help on Raspberry Pi Forums:
UPDATE 2021-09-24: CM4 on CM4IO with Auvidea B102 try 2 (and try 3) (of which topic I of course did not know the location when I wrote this page).


