This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x SD card cd pin

Hello

      We are designing AM335x device based on AM335xevm_SK kit.

      We need to use xdma_intro0 on A15 ball in gpio0[19] mode (mode 7). I have configured everything but could not really able to detect SD card properly. 

im using mmcsdlib() from starterware to configure. i have configured all the others pins, clock correctly. but my code MMCSDCardPresent() always returns "1".

According to the schematic,

it is always connected to 3.3 v through a resistor 10k when open. when a card is inserted, it should be connected to GND. as per the schematic, it is a Input pin.

for the CD pin , i have configured this way.

GPIOModuleClkConfig( 0 );
// 1
HWREG(SOC_CONTROL_REGS + CONTROL_CONF_XDMA_EVENT_INTR(0)) = (1 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_PUDEN_SHIFT) | (1 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_PUTYPESEL_SHIFT) | (1 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_RXACTIVE_SHIFT) | (GPIO_PAD_MODE_7);

// Enabling the GPIO module
GPIOModuleEnable(SOC_GPIO_0_REGS);

// Resetting the GPIO module
GPIOModuleReset(SOC_GPIO_0_REGS);
GPIODirModeSet(SOC_GPIO_0_REGS, 19, GPIO_DIR_INPUT);
GPIOPinWrite(SOC_GPIO_0_REGS, 19, GPIO_PIN_HIGH);

im not able to find out whats wrong, is not pin mux wrong?? or do i need to do additional settings for gpio or so? 

Thanks,

M.Shradhanand

  • Shradhanand,

    A15 doesnot support pinmux configuration for card detect for any instance of MMCSD peripheral. So the card detect functionality has to be realized through GPIO configuration. Please check configuring the debounce.

    Regards,

    Ramesh D

  • Shradhanand,

    The pull up/down configuration is disabled. Please incorporate following modification to enable pull configurations.

    HWREG(SOC_CONTROL_REGS + CONTROL_CONF_XDMA_EVENT_INTR(0)) = (0 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_PUDEN_SHIFT) | (1 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_PUTYPESEL_SHIFT) | (1 << CONTROL_CONF_XDMA_EVENT_INTR0_CONF_XDMA_EVENT_INTR0_RXACTIVE_SHIFT) | (GPIO_PAD_MODE_7);

    Regards,

    Ramesh D

  • Hi Ramesh,

    I configured same way but still i could not make my code detect SD Card. i tried debugging and found that flags CINS and WP of SD_PSTATE register are initially 0 and 1 respectively till we execute this line:

    HWREG(SOC_PRCM_REGS + CM_PER_MMC0_CLKCTRL) |= CM_PER_MMC0_CLKCTRL_MODULEMODE_ENABLE;

    after this, i could see that CINS and WP change to 1 and 0 respectively. after that there is no change at all through out the code. 

    I have read in one blog which says SDCD and WP are optional and in such case, it is always writable and shows always inserted. even in my code i could see that its give the status of always present.

    is it that i need to configure by software means? As per my schematic, A15 ball is connected through GPIO1.19. so i have configured that as above and as a input pin. this pin should show high voltage in open and when card is inserted, this is shorted to GND.

    Can you please help me out solving this issue.

    Regards,

    Shradhanand.M

  • Shradhanand,

    It is recomended to use the Card Detect feature provided by MMCSD IP. StarterWare relase code doesnot provide referance implementation to emulate Card Detect with GPIO. Please refer GPIO example to better help your implementation to configure Card Detect pin as GPIO.

    Regrads,

    Ramesh D

  • Hi Ramesh,

    As you said A15 cannot be used, but as per pin mux tool i could see gpio 0, 19 can be configured for A15 ball. please correct me if am wrong. as per our custom board schematic, external pull up is connected to A15.

    if A15 is not the suitable choice for CD pin, could you please let me know what are the other pins (balls) that can be configured as CD pins.

    Thanks 

    Shradhanand

  • Shradhanand,

    I have not mentioned that A15 cannot be configured as GPIO. But just that it is not the card detect pin supported by any instance of HSMMCSD. 

    Please refer the device datasheet (section 2.3.5 Removable Media Interfaces) for selection of pin to be used as card detect.

    Regards,

    Ramesh D

  • Hi Ramesh,

    i Could configure the SD detect using GPIO.

    Thanks and Regards,

    M.Shradhanand