sdio card detection

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

sdio card detection

2,801 次查看
admin
Specialist II

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?

0 项奖励
回复
3 回复数

1,503 次查看
c0170
Senior Contributor III

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

0 项奖励
回复

1,503 次查看
admin
Specialist II

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

0 项奖励
回复

1,503 次查看
monXii
Contributor III

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 :smileyhappy:

 

  // check if a card is there ..  inserted=TRUE;  param=0;  ioctl (com_handle, IO_IOCTL_ESDHC_GET_CARD, &param);  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..

0 项奖励
回复