Tool/software:
Hi team,
I follow the sample code in the datasheet to do the FrameSync, it is working well.
But when I streaming output with gsteamer it seems not really same capture frame at the moment.
here is my pipeline :
gst-launch-1.0 \ v4l2src device=/dev/video-cam0 io-mode=4 ! video/x-raw,width=1280,height=720,format=UYVY ! tiovxldc ! video/x-raw, format=NV12 ! tiovxmultiscaler target=0 ! video/x-raw, width=320, height=240 ! mosaic.sink_0 \ v4l2src device=/dev/video-cam1 io-mode=4 ! video/x-raw,width=1280,height=720,format=UYVY ! tiovxldc ! video/x-raw, format=NV12 ! tiovxmultiscaler target=0 ! video/x-raw, width=320, height=240 ! mosaic.sink_1 \ v4l2src device=/dev/video-cam2 io-mode=4 ! video/x-raw,width=1280,height=720,format=UYVY ! tiovxldc ! video/x-raw, format=NV12 ! tiovxmultiscaler target=0 ! video/x-raw, width=320, height=240 ! mosaic.sink_2 \ v4l2src device=/dev/video-cam3 io-mode=4 ! video/x-raw,width=1280,height=720,format=UYVY ! tiovxldc ! video/x-raw, format=NV12 ! tiovxmultiscaler target=0 ! video/x-raw, width=320, height=240 ! mosaic.sink_3 \ compositor name=mosaic latency=1000000000 background=0 \ sink_0::xpos=0 sink_0::ypos= 0 \ sink_1::xpos=320 sink_1::ypos= 0 \ sink_2::xpos=640 sink_2::ypos= 0 \ sink_3::xpos=959 sink_3::ypos= 0 ! \ video/x-raw, width=1280, height=240 ! queue ! waylandsink sync=false --no-position &
the script for setting FrameSync :
#This sript is for setting 2 ds90ub962 to enable FrameSync mode on ROVY. DESER_I2C_1=3 DESER_I2C_2=5 UB960_ADDR=0x30 UB960_SR_FS_CTL=0x18 UB960_FS_HIGH_TIME_1=0x19 UB960_FS_HIGH_TIME_0=0x1A UB960_FS_LOWTIME_1=0x1B UB960_FS_LOWTIME_0=0x1C UB960_SR_FPD3_PORT_SEL=0x4C UB960_SR_GPIO_CTL0=0x6E UB960_SR_GPIO_CTL1=0x6F #setting external FrameSync from GPIO1, Generate single FrameSync pulse FS_MODE_SET=0x98 UB960_SR_GPIO1_PIN_CTL=0x11 #--------------master------------------ #Enable deserializer#1 GPIO1 and set internal framesync signal i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_GPIO1_PIN_CTL 0x91 #Set FS_HIGH_TIME_1 i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_FS_HIGH_TIME_1 0x0A #Set FS_HIGH_TIME_0 i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_FS_HIGH_TIME_0 0xD7 #Set FS_LOWTIME_1 i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_FS_LOWTIME_1 0x61 #Set FS_LOWTIME_0 i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_FS_LOWTIME_0 0xA0 #Enable framesync i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_FS_CTL 0x01 #--------------slave------------------- #Setting FrameSync mode i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_FS_CTL $FS_MODE_SET #--------------gpio------------------- #Setting deserializer #1 & #2 back channel GPIO0,1,2,3 output FrameSync for RX_NUM in {0..3}; do RX_PORT=$(((1<<$RX_NUM)+($RX_NUM<<4))) i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_FPD3_PORT_SEL $RX_PORT i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_GPIO_CTL0 0xAA i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_GPIO_CTL1 0xAA i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_FPD3_PORT_SEL $RX_PORT i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_GPIO_CTL0 0xAA i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_GPIO_CTL1 0xAA done
I'm not sure is it causing by what, so I want make 4 camera can output synchronized .
the script for setting synchronized forwarding :
DESER_I2C_1=3 DESER_I2C_2=5 UB960_SR_FWD_CTL1=0x20 UB960_SR_FWD_CTL2=0x21 #--------------fwd sync mode------------------- #all RX port forwarding enabled i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_FWD_CTL1 0x00 i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_FWD_CTL1 0x00 sleep 0.1 #basic synchronized forwarding enabled i2ctransfer -y -f $DESER_I2C_1 w2@$UB960_ADDR $UB960_SR_FWD_CTL2 0x14 i2ctransfer -y -f $DESER_I2C_2 w2@$UB960_ADDR $UB960_SR_FWD_CTL2 0x14
The display streaming will stuck after run the script.
here is the ds90ub960 i2c dump :
root@rovy-4vm:/opt/edgeai-gst-apps# i2cdump -y -f 5 0x30
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 60 00 1e 40 d0 01 00 fe 1c 10 7a 7a 00 09 00 ff `.?@??.???zz.?..
10: 00 00 00 00 00 00 00 00 90 00 00 00 00 00 04 00 ........?.....?.
20: 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ??..............
30: 00 00 01 40 00 00 00 00 00 00 00 00 00 00 00 00 ..?@............
40: 00 a9 71 01 00 00 20 00 00 00 00 12 38 c0 02 00 .?q?.. ....?8??.
50: 00 00 00 00 00 00 00 00 1e 00 00 00 00 00 00 00 ........?.......
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 7c aa aa .............|??
70: eb ec e4 00 00 00 00 c5 00 01 00 00 20 00 00 00 ???....?.?.. ...
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
a0: 00 00 00 00 00 1c 00 00 00 00 00 00 00 00 00 00 .....?..........
b0: 1c 3a 14 08 25 00 18 00 8c 33 83 74 80 00 00 00 ?:??%.?.?3?t?...
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 43 94 05 60 f2 00 00 00 00 00 00 00 00 00 00 .C??`?..........
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 5f 55 42 39 36 30 00 00 00 00 00 00 00 00 00 00 _UB960..........
I did some experiments and found it seems related to some port be enable the forwarding.
For example once I turned port 2 and 3 off, the streaming was start to run. but looks not really good, the display delay over 2 seconds and framerate less than 10 fps. (original 30fps)
i2ctransfer -y -f 5 w2@0x30 0x20 0xc0 //enable forwarding of port0 ,1
The problem does not occur in any specific port, even I change enable port 2 & 3, disable any one port or enable 1 port.
But those issue doesn't happened when setting the synchronized forwarding disabled, all the camera are work good, no latency and 30 fps smoothly.
So I think my camera signal source are good, did I miss any configuration ?