AnsweredAssumed Answered

Can't clear SDHC Interrupt in Kinetis K64F

Question asked by Gabriel Cufaro on Jan 8, 2018
Latest reply on Feb 16, 2018 by Agustin De Ruschi

Hello, I have a problem after detecting the SDHC card insertion interrupt in the corresponding ISR function SDHC_IRQHandler. The reference manual of K64F says, in the bit Card Interrupt of IRQSTAT:

Writing this bit to 1 can clear this bit, but as the interrupt factor from the SDIO card does not clear,
this bit is set again. To clear this bit, it is required to reset the interrupt factor from the external card
followed by a writing 1 to this bit.

What does it mean by 'reset the interrupt factor from the external card'? How can I clear the IRQ from the card? Here's my code that is not working to reset the interrupt:

 

    SDHC->IRQSIGEN &= ~(SDHC_IRQSIGEN_CINTIEN_MASK);    //Clear CINTIEN bit in IRQSTATEN (CINTSEN) and IRQSIGEN.
    SDHC->IRQSTATEN &= ~(SDHC_IRQSTATEN_CINTSEN_MASK);    //

    (SDHC->IRQSTAT) |= SDHC_IRQSTAT_CINT_MASK;            //Reset the interrupt factors in the SDIO card and write 1 to clear CINT interrupt in IRQSTAT.

    SDHC->PROCTL &= ~(SDHC_PROCTL_D3CD_MASK);            //Clear and then set D3CD bit in the PROCTL register.
    (SDHC->PROCTL) |= SDHC_PROCTL_D3CD_MASK;

    SDHC->IRQSIGEN |= SDHC_IRQSIGEN_CINTIEN_MASK;    //Clear CINTIEN bit in IRQSTATEN (CINTSEN) and IRQSIGEN.
    SDHC->IRQSTATEN |= SDHC_IRQSTATEN_CINTSEN_MASK;    //

Outcomes