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.

TMS320F280048C-Q1: I cannot clear SDFM acknowledge flag

Part Number: TMS320F280048C-Q1
Other Parts Discussed in Thread: C2000WARE

Dear experts,

I wrote a program to monitor a voltage using AMC1336-Q. I'm using filter 3 of SDFM and I am clocking  SD-C3 using a clock I generated on one of the PWMs (5MHz). 

The code enters sdfmDR3ISR whenever it gets data. I am cleaning interrupt flags in the ISR but it does not work. Can somebody help me?

The ISR is written below:

__interrupt void sdfmDR3ISR(void)
{
    ESTOP0;

    //
    // Read filter result
    //
    filter3Result[loopCounter] =
           (int16_t)(SDFM_getFilterData(SDFM1_BASE, SDFM_FILTER_3) >> 16U);
    loopCounter++;

    //
    // Clear SDFM flag register (SDIFLG)
    //
    SDFM_clearInterruptFlag(SDFM1_BASE, SDFM_MASTER_INTERRUPT_FLAG |
                            SDFM_FILTER_1_NEW_DATA_FLAG            |
                            SDFM_FILTER_2_NEW_DATA_FLAG            |
                            SDFM_FILTER_3_NEW_DATA_FLAG            |
                            SDFM_FILTER_4_NEW_DATA_FLAG);
    
    //
    // Disable the interrupt and enabling it later in main()
    //
    SDFM_disableInterrupt(SDFM1_BASE, SDFM_FILTER_3, SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT);

    //
    // Acknowledge this interrupt to receive more interrupts from group 5
    //
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
}

  • more info:

    at line 15, AF3 is cleared every other interrupt! 

    I have read in the TRM that "If user writes a "1" to clear a bit on the same cycle that the hardware is trying to set the bit to "1", then hardware has priority and the bit will not be cleared"

    but I don't understand why AF3 is set in this simple ISR? Also, if there is a problem with my code, why is it cleared every other interrupt?

  • Hi Mina,

    Have you tried running any of the C2000Ware SDFM examples ? These examples can be used as good reference to configure the SDFM module.

    In response to the problem in question, how are you making sure that the interrupt is not getting cleared? Is the next interrupt not getting received?

    Thanks
    Vasudha

  • Hi Vasudha,

    Have you tried running any of the C2000Ware SDFM examples ?

    I've tried sdfm_ex1_filter_sync_cpuread. I am reading some data but since I am new to SDFM, I am changing different parts of the code to figure out its registers.

    In response to the problem in question, how are you making sure that the interrupt is not getting cleared?

    I am using filter 3 and am checking AF3 in SDIFLG to see if it cleared.

    Is the next interrupt not getting received?

    It is! I was trying to stop getting interrupts but I couldn't clear AF3.

    However, I could clear AF3 last night! By disabling the interrupt before cleaning the flag, I cleared AF3. But I can't understand why? If I don't want to disable the interrupt, how am I supposed to clear the acknowledge flag?

    Thank you for your response

    Mina

  • Hi Mina,

    The AF flag getting set means that there is new data available to be read. This flag should be cleared to recieve the next interrupt. Not sure what is the usecase but you need not disable the interrupt. The acknowledge flag should be cleared so that the next interrupt can be recieved.

    Thanks
    Vasudha

  • Dear Vasudha,

    This flag should be cleared to recieve the next interrupt.

    exactly! but the problem is it does not clear by using SDFM_clearInterruptFlag(SDFM1_BASE,SDFM_FILTER_3_NEW_DATA_FLAG)!
    I wonder if the case is it gets new data when I am clearing the flag... so I used a while loop to keep clearing the flag until it is cleared... to see if I am clearing the flag too late... but again the flag is getting set right after the loop! I am very confused Confused

    Thank you

    Mina

  • Hi,

    You need not clear the flag in a while loop. If the flag is getting set again that means the new data is available to be read. Are you checking the flag status in debug window while stepping through the code? Are you seeing any issue in your applciation due to this behaviour?

    Thanks
    Vasudha

  • Hi Vasudha,

    Yes, I was checking the flag status in debug window. it was not cleared by using SDFM_clearInterruptFlag, There was no other issue except this.

    Because I couldn't find the problem, I changed my code and disabled the interrupt, and read the data by setting up a timer.

    Thank you for your time