Dear all:
with k60 mcu and mqx, I would like to use cd/data3 as card detection.
So card detection is enabled and the corresponding int also is enable, but there is on intterupt trigger when I have the SD card inserted.
Any ideas?
Hi fzhu129,
what version of MQX are you using? Have you enabled the pull-up for the input pin cd/data3?
This is the command: lwpgio_set_attribute:
lwgpio_set_attribute(&pin_lwgpio_structure, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE);
Regards,
MartrinK
Hello MartrinK:
Mqx3.8.
Our customized don't use extra pin for detecting card.
I am trying to use cd/data[3], right now I am configure cd/data[3] no pull up enable so I can see rising edge when card inserted but I cannot see interrupt being generated.
Don't you have any example to make sd card working in interrupt mode with cd/data[3]?
Thanks
hey fzhu129.
i had the same problem .. i'm using K60 with MQX 3.8 on my cutom board..
i check it polled in my sdcard task .. maybe it helps
// check if a card is there .. inserted=TRUE; param=0; ioctl (com_handle, IO_IOCTL_ESDHC_GET_CARD, ¶m); if (param==0) { inserted=FALSE; }
but for this u need to modify the BSP ..
init_gpio.c
_mqx_int _bsp_esdhc_io_init( uint_8 dev_num, uint_16 value){ SIM_MemMapPtr sim = SIM_BASE_PTR; PORT_MemMapPtr pctl; switch (dev_num) { case 0: /* Configure GPIO for SDHC peripheral function */ pctl = (PORT_MemMapPtr)PORTE_BASE_PTR; pctl->PCR[0] = value & (PORT_PCR_MUX(4) | PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK); /* ESDHC.D1 */ pctl->PCR[1] = value & (PORT_PCR_MUX(4) | PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK); /* ESDHC.D0 */ pctl->PCR[2] = value & (PORT_PCR_MUX(4) | PORT_PCR_DSE_MASK); /* ESDHC.CLK */ pctl->PCR[3] = value & (PORT_PCR_MUX(4) | PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK); /* ESDHC.CMD */ pctl->PCR[4] = value & (PORT_PCR_MUX(4) | /*PORT_PCR_PS_MASK | */PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK); /* ESDHC.D3 */ pctl->PCR[5] = value & (PORT_PCR_MUX(4) | PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK); /* ESDHC.D2 */ /* Enable clock gate to SDHC module */ sim->SCGC3 |= SIM_SCGC3_SDHC_MASK; break; default: /* Do nothing if bad dev_num was selected */ return -1; } return MQX_OK;}
as default data3 is pulled high.. but it must be an pull down! cause the card has the pull up internally..