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.

ECAPIntStatusClear Function Operation

hi. all.

 

I have question.

ECAPIntStatusClear Function in the Starterware 2.00.00.07/drivers/ecap.c is not operated.

 

Original source is below. But This is not worked.

 

void ECAPIntStatusClear(unsigned int baseAdd, unsigned int flag)

 {

     HWREGH(baseAdd + ECAP_ECCLR) = HWREGH(baseAdd + ECAP_ECCLR) & flag;

}

 

Seems to be modified as follows. isn't it? 

==>  HWREGH(baseAdd + ECAP_ECCLR) = HWREGH(baseAdd + ECAP_ECFLG) & flag;

 

  • Hi yul lee,

    Its ECAP_ECCLR, not ECAP_ECFLG.

    ECAP_ECFLG is an interrupt status flag regsister
    whereas ECAP_ECCLR is to clear interrupt flags.

    For more information, you can refer TRM of sections 15.3.4.10 ECAP Interrupt Flag Register (ECFLG)
    and 15.3.4.11 ECAP Interrupt Clear Register (ECCLR).

  • hi,

    Original code don't reset  bit of ECAP_ECFLG

    AM335x TRM 15.3.4.11  --> 'Writing a 0 has no effect. Always reads back a 0.'

    Therefore ECAP_ECCLR can't read Interrupt status value.

     

     HWREGH(baseAdd + ECAP_ECCLR) = HWREGH(baseAdd + ECAP_ECCLR) & flag;

     

    This code result is always  ' HWREGH(baseAdd + ECAP_ECCLR) = (0 & flag)'  ?

     

    Please Check.!

     

     

     

  •   

    Hi Yul lee,

    Thanks for pointing out the error in the ECAPIntStatusClear API.

    This shall be corrected in the next release.

    Problem:

    HWREGH(baseAdd + ECAP_ECCLR) = HWREGH(baseAdd + ECAP_ECCLR) & flag;

    Reading from ECAP_ECCLR register has no effect as it always gives a zero,

    the Interrrupt flag Status can be read from ECAP_ECFLG register.

    The solution as you have correctly pointed out is to read from Interrupt flag register to clear the Interrupt Status as mentioned below.

    HWREGH(baseAdd + ECAP_ECCLR) = HWREGH(baseAdd + ECAP_ECFLG) & flag;

    The above fix can be used to clear the Interrupt Status.

    Regards

    Anant Pai