This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

encode demo on custom DM368 board

The encode demo runs fine on the DM368EVM, but it hangs on my board. I am using DVSDK4.02

./encode -I 4 -v test.264 -t 5 -r 640x480 -w


Encode demo started.
davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124
davinci_previewer davinci_previewer.2: ipipe_set_preview_config
davinci_previewer davinci_previewer.2: ipipe_set_preview_config
vpfe-capture vpfe-capture: IPIPE Chained
vpfe-capture vpfe-capture: Resizer present
EVM: switch to MT9P031 imager video input
-----Exposure time = 2f2
-----Exposure time = 2f2
vpfe-capture vpfe-capture: width = 640, height = 480, bpp = 1
vpfe-capture vpfe-capture: adjusted width = 640, height = 480, bpp = 1, bytesperline = 640, sizeimage = 460800
vpfe-capture vpfe-capture: width = 640, height = 480, bpp = 1
vpfe-capture vpfe-capture: adjusted width = 640, height = 480, bpp = 1, bytesperline = 640, sizeimage = 460800
ARM Load: 47% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 00:00:02 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 640x480 Sound Codec: N/A Sampling Freq: N/A

ARM Load: 95% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 00:00:04 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 640x480 Sound Codec: N/A Sampling Freq: N/A

ARM Load: 95% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 00:00:06 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 640x480 Sound Codec: N/A Sampling Freq: N/A

What could be possible reasons? The MT9P031 is generating good looking waveforms, PIXCLK is 56MHz, LineValid=22Khz, FieldValid=33Hz.

Thanks!!!!

  • Hi Hongfeng,

    Can you try running the application with DMAI_DEBUG=2:

    DMAI_DEBUG=2 ./encode -I 4 -v test.264 -t 5 -w

    This should give you some trace output that would help with your debugging. My guess is that the capture thread (see captureThrFxn() in dvsdk-demos_4_02_00_01/dm365/encode/capture.c) is stuck either in initialization (i.e. Capture_create) of the video driver or waiting for video data to come in (i.e. Capture_get). You may also want to insert your own debug "printf" calls throughout the thread to better isolate the issue.

    Best regards,

    Vincent

  • Thanks for the reply, Vincent.

    I tried your suggestion, it appears to be stuck at catpure_get() function. How do I dig deeper into this?

    Encode demo started.
    @0x000e2b4b:[T:0x402fe000] ti.sdo.dmai - [Dmai] Dmai log level set to '2'. Note that calling CERuntime_init after this point may cause unexpected change to DMAI tracing behavior.
    @0x000f987e:[T:0x402fe000] ti.sdo.dmai - [Display] Found width=720 height=576, yres_virtual=576,xres_virtual=720, line_length=384
    @0x000f9a25:[T:0x402fe000] ti.sdo.dmai - [Display] Setting width=720 height=576, yres_virtual=576, xres_virtual=720
    @0x000f9afc:[T:0x402fe000] ti.sdo.dmai - [Display] New width=720, height=576, yres_virtual=576,xres_virtual=720, line_length=384
    @0x000f9bd6:[T:0x402fe000] ti.sdo.dmai - [BufTab] Allocating BufTab for 1 buffers
    @0x000f9d4d:[T:0x402fe000] ti.sdo.dmai - [Buffer] Set user pointer 0x40308000 (physical 0x81300000)
    @0x000fa2cf:[T:0x402fe000] ti.sdo.dmai - [Display] Display buffer 0 mapped to 0x40308000 has physical address 0x20bd8
    @0x0010davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124
    3b16:[T:0x40b3d4davinci_previewer davinci_previewer.2: ipipe_set_preview_config
    70] ti.sdo.dmai - [BufTab] Allocdavinci_previewer davinci_previewer.2: ipipe_set_preview_config
    ating BufTab for 3 buffers
    @0x00103d46:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x40b3e000 (0x8781b000 phys)
    @0x00103f4f:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x40cb8000 (0x876a1000 phys)
    @0x00104194:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x40e32000 (0x87c4c000 phys)
    @0x00104297:[T:0x40b3d470] ti.sdo.dmai - [BufTab] Allocating BufTab for 4 buffers
    @0x001044d7:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x41100000 (0x860be000 phys)
    @0x0010477c:[T:0x40b3d470] ti.sdo.dmai - [Buffer]vpfe-capture vpfe-capture: IPIPE Chained
     Alloc Buffer ofvpfe-capture vpfe-capture: Resizer present
     size 1382400 at 0x414f5000 (0x8EVM: switch to MT9P031 imager video input
    5cc9000 phys)
    @0x001049f5:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x418ea000 (0x858d4000 phys)
    @0x00104c7d:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x41cdf000 (0x854df000 phys)
    @0x00105258:[T:0x428d3470] ti.sdo.dmai - [Venc1] Creating encoder h264enc for max 1280x720 bitrate 2000000 ratectrl 4
    @0x001080e2:[T:0x40b3d470] ti.sdo.dmai - [Resize] Successfully set mode to continuous in resizer
    @0x00109718:[T:0x40b3d470] ti.sdo.dmai - [Resize] Resizer initialized
    @0x00109868:[T:0x40b3d470] ti.sdo.dmai - [Resize] Operating mode changed successfully to continuous in previewer
    @0x0010b9c6:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting RGB color pallet
    @0x0010d981:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for LUT Defect Correction
    @0x0010da8f:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for OTF Defect Pixel Correction
    @0x0010db3f:[T:0x40b3d470] ti.sdo.dmai - [Resize] S-----Exposure time = 2f2etting default f
    -----Exposure time = 2f2or 2-D Noise filter - 1
    @0x0010
    vpfe-capture vpfe-capture: width = 1280, height = 720, bpp = 1
    dbe3:[T:0x40b3d4vpfe-capture vpfe-capture: adjusted width = 1280, height = 720, bpp = 1, bytesperline = 1280, sizeimage = 1382400
    70] ti.sdo.dmai - [Resize] Setting default for 2vpfe-capture vpfe-capture: width = 1280, height = 720, bpp = 1
    -D Noise filter - 2
    @0x0010dc83vpfe-capture vpfe-capture: adjusted width = 1280, height = 720, bpp = 1, bytesperline = 1280, sizeimage = 1382400
    :[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Green Imbalance Correction
    @0x0010dd1e:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for White balance
    @0x0010ddb9:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for CFA Interpolation
    @0x0010de54:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for RGB-RGB Conversion - 1
    @0x0010def1:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Gamma Correction
    @0x0010dfb9:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for RGB-RGB Conversion - 2
    @0x0010e05c:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for 3D LUT
    @0x0010e0f3:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for RGB-YCbCr conversion
    @0x0010e18f:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Global Brightness,Contrast Control
    @0x0010e229:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for YUV 422 conversion
    @0x0010e2c1:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Luminance Adjustment
    @0x0010e358:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Edge Enhancer
    @0x0010e3f0:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Chromatic Artifact Reduction
    @0x0010e4aa:[T:0x40b3d470] ti.sdo.dmai - [Resize] Setting default for Chromatic Gain Suppression
    @0x0010e557:[T:0x40b3d470] ti.sdo.dmai - [Resize] Previewer initialized
    @0x0011ce45:[T:0x40b3d470] ti.sdo.dmai - [Capture] Camera input selected
    @0x00133112:[T:0x40b3d470] ti.sdo.dmai - [Capture] Setting video standard to: 9
    @0x00133212:[T:0x40b3d470] ti.sdo.dmai - [Capture] Capture input set to Camera:9
    @0x001332ab:[T:0x40b3d470] ti.sdo.dmai - [Capture] Forcing user specified video standard
    @0x0013332b:[T:0x40b3d470] ti.sdo.dmai - [Capture] Capture dimention is set to 1280x720
    @0x0014994c:[T:0x40b3d470] ti.sdo.dmai - [Capture] Video input connected size 1280x720 pitch 1280
    @0x0017027f:[T:0x40b3d470] ti.sdo.dmai - [BufTab] Allocating BufTab for 3 buffers
    @0x00170a83:[T:0x428d3470] ti.sdo.dmai - [Venc1] Setting dynParams size 1280x720 bitrate 2000000
    @0x00170d3a:[T:0x428d3470] ti.sdo.dmai - [Venc1] Made XDM_SETPARAMS control call
    @0x001712cc:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x4312f000 (0x83f24000 phys)
    @0x0017151d:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x43a81000 (0x84076000 phys)
    @0x00171754:[T:0x40b3d470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x43bd3000 (0x841c8000 phys)
    @0x00187529:[T:0x43a80470] ti.sdo.dmai - [BufTab] Allocating BufTab for 10 buffers
    @0x001877b0:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x43d25000 (0x8431a000 phys)
    @0x001879c9:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x43e77000 (0x8446c000 phys)
    @0x00187c28:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x43fc9000 (0x845be000 phys)
    @0x00187e63:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x4411b000 (0x84710000 phys)
    @0x0018809d:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x4426d000 (0x84862000 phys)
    @0x001882d6:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x443bf000 (0x849b4000 phys)
    @0x00188515:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x44511000 (0x84b06000 phys)
    @0x00188757:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x44663000 (0x84c58000 phys)
    @0x00188997:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x447b5000 (0x84daa000 phys)
    @0x00188bf6:[T:0x43a80470] ti.sdo.dmai - [Buffer] Alloc Buffer of size 1382400 at 0x44907000 (0x84efc000 phys)
    ARM Load: 4% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 18:00:01 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 1280x720 Sound Codec: N/A Sampling Freq: N/A

    ARM Load: 0% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 18:00:02 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 1280x720 Sound Codec: N/A Sampling Freq: N/A

    ARM Load: 0% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 18:00:03 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 1280x720 Sound Codec: N/A Sampling Freq: N/A

    ARM Load: 0% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 18:00:04 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 1280x720 Sound Codec: N/A Sampling Freq: N/A

    ARM Load: 0% Video fps: 0 fps Video bit rate: 0 kbps Sound bit rate: 0 kbps Time: 18:00:06 Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: 1280x720 Sound Codec: N/A Sampling Freq: N/A

  • I found there is no interrupts from  vpfe_capture0. IRQK_handler didn't even show up.

    The waveforms of HD,VD and PCLK are almost identical to those on EVM.

    The pinmux should be set properly in dm365_ccdc.c.

    Am I missing some simple stuff?

  • Hi,

    One simple thing that can cause the interrupts not asserting is that you might have set the VDINT0 register value to be higher than the number of input lines in the frame. Please check the value of that register and compare it against the input frame height. VDINT0 should be set to (frame height - 32) approx.

    Regards,

    Anshuman

    PS: Please mark this post as verified, if you think it has answered your question. Thanks.

  • Anshuman:

    Thank you so much for your help.

    Now I have found something interesting:

    I inserted these two lines at the end of function ccdc_setwin()

        dev_dbg(dev, "vert_nr_lines=%d",vert_nr_lines);
        dev_dbg(dev, "VDINT0=%d",regr(VDINT0));
        dev_dbg(dev, "VDINT1=%d",regr(VDINT1));

    And I found the output are:

    vpfe-capture vpfe-capture: vert_nr_lines=719
    vpfe-capture vpfe-capture: VDINT0=0
    vpfe-capture vpfe-capture: VDINT1=0

    Obviously the VDINT0 was just set by this code: regw(vert_nr_lines, VDINT0);

    Why?

     

     

    Two more questions:

    1) will VDINT0=0 cause no interrupts?

    2)Is there any good user space program to access those registers? I am using http://designsomething.org/leopardboard/f/23/t/77.aspx


    Regards,

    Hongfeng

     

  • Hongfeng Wang said:

    1) will VDINT0=0 cause no interrupts?

    Ideally No. VDINT0 = 0 should have given you interrupts. Although it would mean that your buffer switching would not work correctly. But still the interrupts should have come. Can you check the polarity of the VD signal and see if it is correctly programmed in ISIF register?

    Hongfeng Wang said:

    2)Is there any good user space program to access those registers? I am using http://designsomething.org/leopardboard/f/23/t/77.aspx

     If you are using DVSDK2.x, you can use the attached utilities.

    Regards,

    Anshuman

    reg_rw_tools.zip
  • Thanks, Anshuman.

     

    1) I am using DVSDK4.02, the readl in your attachement returns all zero when trying to read ISIF registers. But the readback from DM36x evm makes sense: VDINT=719, as expected.

    I can use readl and writel to change register values on the EVM, but it always reads back zero on my board. This is consistent with previous observation: in ccdc_setwin(), right after regw(vert_nr_lines, VDINT0); the readback of VDINT0 is zero.

    2) Since MODESET in EVM is also zero ( VD positive), I guess the VD polarity is not the cause. I just feel the whole VPSS module on my board behaves funny. Another strange thing may or  may not be related: once VFBE is initialized, the DM368 chip gets very hot. I haven't got the component video to work yet.

     

    Best regards,

    Hongfeng

  • Thanks to Anshuman and Vicent, I finally are making some progress.

    I found a circuit design error causing VPBE over current thus the whole VPSS not working properly.

    Now I finally see interrupts coming in!

  • Update:

    Now the encodedecode -p runs fine, video_loopback_dm368.x470MV runs fine too.
    But I still have trouble with the encode demo: it hangs after 5 frames every time, the interrupts counter keeps increasing though.

    davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:124
    davinci_previewer davinci_previewer.2: ipipe_set_preview_config
    davinci_previewer davinci_previewer.2: ipipe_set_preview_config
    vpfe-capture vpfe-capture: IPIPE Chained
    vpfe-capture vpfe-capture: Resizer present
    EVM: switch to MT9P031 imager video input
    -----Exposure time = 5f4
    -----Exposure time = 5f4
    vpfe-capture vpfe-capture: width = 736, height = 480, bpp = 1
    vpfe-capture vpfe-capture: adjusted width = 736, height = 480, bpp = 1, bytesperline = 736, sizeimage = 529920
    vpfe-capture vpfe-capture: width = 736, height = 480, bpp = 1
    vpfe-capture vpfe-capture: adjusted width = 736, height = 480, bpp = 1, bytesperline = 736, sizeimage = 529920
    davinci_v4l2 davinci_v4l2.1: Before finishing with S_FMT:
    layer.pix_fmt.bytesperline = 736,
     layer.pix_fmt.width = 720,
     layer.pix_fmt.height = 480,
     layer.pix_fmt.sizeimage =529920
    davinci_v4l2 davinci_v4l2.1: pixfmt->width = 720,
     layer->layer_info.config.line_length= 736
    Invalid pin mux index: 109 (95)
    Backtrace:
    [<c002e5f4>] (dump_backtrace+0x0/0x114) from [<c02d290c>] (dump_stack+0x18/0x1c)
     r7:00000190 r6:fec40000 r5:419669c0 r4:bf01bcfc
    [<c02d28f4>] (dump_stack+0x0/0x1c) from [<c0036298>] (davinci_cfg_reg+0x48/0xf4)
    [<c0036250>] (davinci_cfg_reg+0x0/0xf4) from [<bf01b398>] (ioctl+0x18c/0x3bc [irqk])
     r7:00000190 r6:0000000a r5:419669c0 r4:bf01bcfc

    [<bf01b20c>] (ioctl+0x0/0x3bc [irqk]) from [<c00a941c>] (vfs_ioctl+0x34/0x94)
    [<c00a93e8>] (vfs_ioctl+0x0/0x94) from [<c00a9aec>] (do_vfs_ioctl+0x578/0x5d4)
     r7:c2909500 r6:00000004 r5:c2909500 r4:c29168a8
    [<c00a9574>] (do_vfs_ioctl+0x0/0x5d4) from [<c00a9b88>] (sys_ioctl+0x40/0x64)
    [<c00a9b48>] (sys_ioctl+0x0/0x64) from [<c002af40>] (ret_fast_syscall+0x0/0x28)
     r7:00000036 r6:00000000 r5:00000000 r4:00000004

    About the pin mux error, I can see it's from the davinci_cfg_reg, how do I read the backtrace to find out the cause?

    Best regards,

    Hongfeng