Can't clear SDHC Interrupt in Kinetis K64F

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't clear SDHC Interrupt in Kinetis K64F

346 Views
gabrielcufaro
Contributor I

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;    //

Labels (1)
0 Kudos
2 Replies

172 Views
agustinderuschi
Contributor I

Hola Gabi, como estas?

0 Kudos

172 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Gabriel Cufaro


You are working with the CINT bit (Card Interrupt), but there is another bit called CINS (Card Insertion), in this case you use the DAT3 As Card Detection Pin (SDHC_PROCTL[D3CD]). For this case you only have to disable the interrupt signal with IRQSIGEN before leaving the handler.

I recommend you to check the example provided in the SDK drivers, there is a frdmk64f_driver_examples_sdcard_interrupt example which can be used with this mode.

Hope this helps.
Best Regards

0 Kudos