Can't clear SDHC Interrupt in Kinetis K64F

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Can't clear SDHC Interrupt in Kinetis K64F

524件の閲覧回数
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;    //

ラベル(1)
0 件の賞賛
2 返答(返信)

350件の閲覧回数
agustinderuschi
Contributor I

Hola Gabi, como estas?

0 件の賞賛

350件の閲覧回数
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 件の賞賛