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.

DM6437VPFE中断问题



我想用VPFE中的VDINT0中断来判断获取图像一帧采集完成,但是我配置好了中断以后却得不到这个中断,我的配置代码如下

CSR=0x100;/* disable all interrupts */
IER=1;/* disable all interrupts except NMI */
ICR=0xffff;/* clear all pending interrupts */
ISTP = 0x10800400;
INTC_EVTCLR0 = 0xFFFFFFFF;
INTC_EVTCLR1 = 0xFFFFFFFF;
INTC_EVTCLR2 = 0xFFFFFFFF;
INTC_EVTCLR3 = 0xFFFFFFFF;
//INTC_EVTFLAG1=0x00000000;
INTC_EVTMASK3 = 0xFFFFFFFF;
INTC_EVTMASK2 = 0xFFFFFFFF;
INTC_EVTMASK1 = 0xFFFFFFFF;
INTC_EVTMASK0 = 0xFEFFFFFF; //24
 INTC_INTMUX3 = 0x00180000; //CPUINT7 //24 VPSS-CCDC0
IER |= 0x00004002; //使能中断14
CSR=0x01 ;/* enable all interrupts

请问有什么问题吗?还是说VPFE中的某个寄存器还需要配置??

  • Lin Yong,

    VDINT0寄存器的值设置的是多少?一般是行数-5.

  • VDINT0的值不是0-7FFFh吗,怎么会出现-5呢??

    经过我的检查发现是ISTP写错了,现在已经可以进入中断了,但是发现返回不了主函数了。我写了下面的一个测试函数,应该是不断输出0和sum的值的,但是现在只有sum的值,没有flag的值0。

    while(1)
    {
    if(flag==1)
    {
    flag=0;
    printf("%d\n",flag);
    }

    }

    interrupt void extint14_isr(void)
    {
    flag=1;
    sum++;
    printf("%d\n",sum);
    return;
    }

  • 我设的是0,请问这个寄存器是干什么用的,我一直不懂。

  • Lin Yong,

    VDINT0寄存器设置的是在外部帧同步有效后多少行后触发VD中断,这个值一般设定的是图像的行数-5。

  • 我改成VDINT0设为0,它就一直不停得中断,好像是一个时钟周期就中断,反正很快,可一旦设置为别的值,就连中断也没了。是不是还有什么关键的寄存器我设置错误了??下面的是我的ccdc的配置,能帮忙看一下吗?十分感谢。

    void vpfe_init( Uint32 buffer, Uint32 width, Uint32 height)
    {
    //VPFE_CCDC_SYN_MODE = 0x00032F80; // INPUT
    VPFE_CCDC_SYN_MODE = 0x00032F83; //VD as positive *********change VD HD output 0x00032F80
    //VPFE_CCDC_SYN_MODE = 0x00032F87; // interlaced, with VD pority as negative VD HD output
    // VPFE_CCDC_SYN_MODE = 0x00031084; //linger interlaced, with VD pority as negative VD HD output
    //VPFE_CCDC_HD_VD_WID = 0x00010001;
    VPFE_CCDC_HD_VD_WID = 0;
    // VPFE_CCDC_PIX_LINES = 0x02CF0271;
    VPFE_CCDC_PIX_LINES = 0; //linger 720x624 when VD HD is input,it not used.
    //VPFE_CCDC_PIX_LINES=0x020d0271;;

    /*
    * sph = 1, nph = 1440, according to page 32-33 of the CCDC spec
    * for BT.656 mode, this setting captures only the 720x480 of the
    * active NTSV video window
    */
    VPFE_CCDC_HORZ_INFO = width << 1; // Horizontal lines
    VPFE_CCDC_HSIZE_OFF = width << 1; // Horizontal line offset
    // VPFE_CCDC_HORZ_INFO = width<< 1; // Horizontal lines
    // VPFE_CCDC_HSIZE_OFF = 0; // Horizontal line offset
    VPFE_CCDC_VERT_START = 0; // Vertical start line
    VPFE_CCDC_VERT_LINES = height >> 1; // Vertical lines
    VPFE_CCDC_CULLING = 0xFFFF00FF; // Disable cullng

    /*
    * Interleave the two fields
    */
    VPFE_CCDC_SDOFST = 0x00000249; 
    VPFE_CCDC_SDR_ADDR = buffer;
    VPFE_CCDC_CLAMP = 0;
    VPFE_CCDC_DCSUB = 0;
    VPFE_CCDC_COLPTN = 0xEE44EE44;
    VPFE_CCDC_BLKCMP = 0;
    VPFE_CCDC_FPC_ADDR = 0x86800000;
    VPFE_CCDC_FPC = 0;
    VPFE_CCDC_VDINT=0x01E00000;///?????????????????? *********change
    ////VPFE_CCDC_VDINT = 0;
    VPFE_CCDC_ALAW = 0;
    VPFE_CCDC_REC656IF = 0x00000003;
    // VPFE_CCDC_REC656IF = 0x00000002; //linger

    /*
    * Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position
    */
    //VPFE_CCDC_CCDCFG = 0x00000800;
    VPFE_CCDC_CCDCFG = 0x00008800;
    // VPFE_CCDC_FMTCFG = 0;
    VPFE_CCDC_FMTCFG = 0x00008000; //linger
    VPFE_CCDC_FMT_HORZ = 0x000002D0;
    VPFE_CCDC_FMT_VERT = 0x00000240;//0x00000272;
    VPFE_CCDC_FMT_ADDR0 = 0;
    VPFE_CCDC_FMT_ADDR1 = 0;
    VPFE_CCDC_FMT_ADDR2 = 0;
    VPFE_CCDC_FMT_ADDR3 = 0;
    VPFE_CCDC_FMT_ADDR4 = 0;
    VPFE_CCDC_FMT_ADDR5 = 0;
    VPFE_CCDC_FMT_ADDR6 = 0;
    VPFE_CCDC_FMT_ADDR7 = 0;
    VPFE_CCDC_PRGEVEN_0 = 0;
    VPFE_CCDC_PRGEVEN_1 = 0;
    VPFE_CCDC_PRGODD_0 = 0;
    VPFE_CCDC_PRGODD_1 = 0;
    VPFE_CCDC_VP_OUT = 0x04E22D00;
    VPFE_CCDC_PCR = 0x00000001; // Enable CCDC
    }

  • Lin Yong,

    VD中断应该是每一帧/每一场都后触发一次的。

    你说除了配置VDINT0为0以外,其他值都收不到中断。请问你其他值尝试了哪些?你输入的图像大小是多少?

  • VDINT=0x01E00000,里面的0x01E0就是VDINT0的值,中断源是14号中断,VDINT0的中断是事件24,图像大小是720*480,我475到480还有1、2什么的值都试过了。

  • Lin Yong,

    你是两场的数据么?如果是,就应该是每场的高度-5。你试试235/230看看。

  • 非常感谢,问题已经解决了,设置成235就可以了。那这样的话是两次中断算一帧,还是一次中断一帧。

  • 如果是两场的数据,每场就有一个vd中断,一帧是由两场组成的。

  • 您好,我这边中断可以进可以出,但是我不确定这个中断是否是我所需要的中断,我想问一下这里的中断在输入图像为PAL的情况下是否20ms中断一次?

  • Wei Baogang,

    如果是VD中断,PAL输入是50场,是20ms一次。

  • 您好,我这边对中断的使用不是特别理解,在这里我想请教一下您,忘大神指教,具体例子就用前面讨论的(就是打开VDINT中断)

    1、首先我拷入了一个vector.asm文件具体内容如下:

    *
    * Copyright (C) 2003 Texas Instruments Incorporated
    * All Rights Reserved
    *
    *
    *---------vecs_timer1.asm---------
    *
    * Assembly file to set up interrupt service table (IST)
    *

    *------------------------------------------------------------------------------
    * Global symbols defined here and exported out of this file
    *------------------------------------------------------------------------------
    .global _vectors
    .global _c_int00
    .global _vector1
    .global _vector2
    .global _vector3
    .global _vector4
    .global _vector5
    .global _vector6
    .global _vector7
    .global _vector8
    .global _vector9
    .global _vector10
    .global _vector11
    .global _vector12
    .global _vector13
    .global _extint7_isr ; Hookup the c_int14 ISR in main()
    .global _vector15

    *------------------------------------------------------------------------------
    * Global symbols referenced in this file but defined somewhere else.
    * Remember that your interrupt service routines need to be referenced here.
    *------------------------------------------------------------------------------
    .ref _c_int00
    .ref _extint14_isr ; external interrupt INT 7 handler
    *------------------------------------------------------------------------------
    * This is a macro that instantiates one entry in the interrupt service table.
    *------------------------------------------------------------------------------
    VEC_ENTRY .macro addr
    STW B0,*--B15
    MVKL addr,B0
    MVKH addr,B0
    B B0
    LDW *B15++,B0
    NOP 2
    NOP
    NOP
    .endm


    *------------------------------------------------------------------------------
    * This is a dummy interrupt service routine used to initialize the IST.
    *------------------------------------------------------------------------------
    _vec_dummy:
    B B3
    NOP 5

    *------------------------------------------------------------------------------
    * This is the actual interrupt service table (IST). It is properly aligned and
    * is located in the subsection .text:vecs. This means if you don't explicitly
    * specify this section in your linker command file, it will default and link
    * into the .text section. Remember to set the ISTP register to point to this
    * table.
    *------------------------------------------------------------------------------
     .sect ".vectors"
    ;.align 1024

    _vectors:
    _vector0: VEC_ENTRY _c_int00 ;RESET
    _vector1: VEC_ENTRY _vec_dummy ;NMI
    _vector2: VEC_ENTRY _vec_dummy ;RSVD
    _vector3: VEC_ENTRY _vec_dummy
    _vector4: VEC_ENTRY _vec_dummy
    _vector5: VEC_ENTRY _vec_dummy
    _vector6: VEC_ENTRY _vec_dummy
    _vector7: VEC_ENTRY _vec_dummy
    _vector8: VEC_ENTRY _vec_dummy
    _vector9: VEC_ENTRY _vec_dummy
    _vector10: VEC_ENTRY _vec_dummy
    _vector11: VEC_ENTRY _vec_dummy
    _vector12: VEC_ENTRY _vec_dummy
    _vector13: VEC_ENTRY _vec_dummy
    _vector14: VEC_ENTRY _extint14_isr ; Hookup the c_int14 ISR in main()
    _vector15: VEC_ENTRY _vec_dummy

    *------------------------------------------------------------------------------

    在这里这个文件我只是单纯的从网上当下来的,然后添加进工程中

    2、开辟存储空间:

    VECS:       o = 0x10800000  l = 0x00000400

      .vectors > VECS

    在这里需要将 .vectors设置同asm文件中 .sect ".vectors"相同吧?

    3、初始化中断并打开

    CSR=0x100;/* disable all interrupts */
    IER=1;/* disable all interrupts except NMI */
    ICR=0xffff;/* clear all pending interrupts */
    ISTP = 0x10800000;
    INTC_EVTCLR0 = 0xFFFFFFFF;
    INTC_EVTCLR1 = 0xFFFFFFFF;
    INTC_EVTCLR2 = 0xFFFFFFFF;
    INTC_EVTCLR3 = 0xFFFFFFFF;
    //INTC_EVTFLAG1=0x00000000;
    INTC_EVTMASK3 = 0xFFFFFFFF;
    INTC_EVTMASK2 = 0xFFFFFFFF;
    INTC_EVTMASK1 = 0xFFFFFFFF;
    INTC_EVTMASK0 = 0xFEFFFFFF; //24
    INTC_INTMUX3 = 0x00180000; //CPUINT7 //24 VPSS-CCDC0
    IER |= 0x00004002; //使能中断14
    CSR=0x01 ;//enable all interrupts

    4、中断服务程序

    interrupt void extint14_isr(void) //20ms进一次中断
    {
    INT_flag++;
    if(INT_flag==2)
    {
    EVMDM6437_GPIO_setOutput(2,0);
    ping_pong_buffer(BUF_flag); //160ms
    EVMDM6437_GPIO_setOutput(2,1);
    INT_flag=0;
    if(BUF_flag==0) BUF_flag=1;
    else if(BUF_flag==1) BUF_flag=0;
    }