FRDM-K66F microSD Detect pin doesn't trigger interrupt on card insert or removal

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

FRDM-K66F microSD Detect pin doesn't trigger interrupt on card insert or removal

ソリューションへジャンプ
463件の閲覧回数
aaronm
Contributor III

Board: FRDM-K66F.  SDK: 2.11.0 (541 2022-01-14)

SDK components selected:

project_template.frdmk66f.MK66F18
device.MK66F18_startup.MK66F18
platform.drivers.clock.MK66F18
component.uart_adapter.MK66F18
device.MK66F18_system.MK66F18
platform.drivers.rtc.MK66F18
platform.drivers.port.MK66F18
platform.drivers.smc.MK66F18
CMSIS_Include_core_cm.MK66F18
component.serial_manager_uart.MK66F18
component.lists.MK66F18
utility.debug_console.MK66F18
platform.drivers.gpio.MK66F18
device.MK66F18_CMSIS.MK66F18
platform.drivers.uart.MK66F18
platform.drivers.i2c.MK66F18
component.serial_manager.MK66F18
platform.drivers.common.MK66F18
middleware.fatfs.sd.MK66F18
middleware.sdmmc.osa.bm.MK66F18
middleware.sdmmc.common.MK66F18
middleware.sdmmc.host.sdhc.MK66F18
middleware.sdmmc.sd.MK66F18
middleware.sdmmc.sdhc.template.MK66F18
middleware.sdmmc.host.sdhc.interrupt.MK66F18
platform.drivers.sdhc.MK66F18
component.osa_bm.MK66F18
middleware.fatfs.MK66F18
platform.drivers.flash.MK66F18
middleware.fatfs.template_sd.MK66F18
platform.drivers.pit.MK66F18

I have the pins selected as indicated in the attached image.  GPIO pin PTD10 is used as "card detect," and I have a port interrupt handler, as well as a breakpoint on the interrupt handler, to trigger when the pin B3 / PTD10 pin goes up or down; in theory.  The SW2 and SW3 buttons are configured similarly with interrupts, and they trigger when pushed; they work as expected.  However, when I insert or remove the micro SD card, I don't get an interrupt on pin B3 / PTD10.  This could be handled by the SDK somewhere else, though BOARD_SDMMC_SD_CD_PORT_IRQ_HANDLER is configured to point to my PORTD_IRQHandler.

Shouldn't I expect a hardware interrupt on pin B3 / PTD10 when a micro SD card is inserted or removed?

Screenshot 2024-07-02 at 6.38.32 PM.png

0 件の賞賛
返信
1 解決策
420件の閲覧回数
aaronm
Contributor III

I haven't tested it extensively, and I have a holiday picnic to attend, but I changed the PTD10 "Pull select" to "Pulldown" and the "Pull enable" to "Enabled," and then ran a quick test: the interrupt *did* trigger when the card was inserted.  Again, I have to test this more fully, but it looks like an operator error (mine -- oops).  

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
421件の閲覧回数
aaronm
Contributor III

I haven't tested it extensively, and I have a holiday picnic to attend, but I changed the PTD10 "Pull select" to "Pulldown" and the "Pull enable" to "Enabled," and then ran a quick test: the interrupt *did* trigger when the card was inserted.  Again, I have to test this more fully, but it looks like an operator error (mine -- oops).  

0 件の賞賛
返信
399件の閲覧回数
aaronm
Contributor III

Yeah, in the SDK example source, in BOARD_InitPins (pin_mux.c), pin PTD10 is configured with kPORT_PullUp - this is provided by NXP; I didn't change this - and as such, the interrupt is never triggered.  The example program does not properly detect whether the card is inserted or not.  My own example program now works properly.  The example code should be updated to use kPORT_PullDown, instead.

0 件の賞賛
返信
437件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that microSD Detect pin does not use interrupt mode, while it uses polling mode from application requirement.

For example, you want to establish a file and save data to the file. After the chip receive commands from host, it initializes the SD card, polls the INSERT pin logic, establish a file,...

But this is not the application requirement, when you insert the SD  card, the chip enters an ISR and establish a file system do something...

 

Hope it can help you

BR

XiangJun Rong

 

0 件の賞賛
返信
431件の閲覧回数
aaronm
Contributor III

Thank you, but it doesn't really help.  For testing, I created an example project from the SDK for "sdcard_fatfs," and tried to get it to run with and without the SD card inserted into the slot, but the test for the presence of an SD card - checking the bit value of PTD10 - returns "1" in all cases, whether the card is installed or not.  In fact, PTD10 reads "1" in all cases, once the program is started.

Screenshot 2024-07-04 at 1.16.54 AM.png

I noticed the PORTD_IRQHandler is configured and enabled in the source code, but the handler is never called.  I've included the SDK example program I used for testing so you can check it for yourself.  Perhaps I'm overlooking something very simple.

Aaron

0 件の賞賛
返信