cancel
Showing results for 
Search instead for 
Did you mean: 

Card detect and Dat 3 on SDIO ?

antonius
Senior
Posted on April 10, 2014 at 12:36

Guys,

Do I need to use Card detect ? (CD) because it's joined together on my connector...and in the code it's separated as two pins ?

Any ideas ?

thanks

0690X00000602ssQAA.jpg0690X00000602jmQAA.jpg
7 REPLIES 7
Posted on April 10, 2014 at 15:33

Your diagram and legend do not correlate. The socket has 11 pins, the last two being physical switches, one for CD (Card Detect) and the other WP (Write Protect)

You should connect DAT3 to the SDIO D3 pin, it's ''CD'' function relates to a non-switched method where the card indicates it's presence.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antonius
Senior
Posted on April 11, 2014 at 02:06


 1.
#define SD_DETECT_PIN GPIO_Pin_14 /* PB.14 */
2.
#define SD_DETECT_GPIO_PORT GPIOB /* GPIOB */
3.
#define SD_DETECT_GPIO_CLK RCC_APB2Periph_GPIOB
4.
5.
/*!< Configure SD_CD pin: SD Card detect pin */
6.
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
7.
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
8.
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);

I connected CD to PB14 but SD card didn't give me a response, do I need CD really ? or I can disconnect it ? thanks
Posted on April 11, 2014 at 02:31

Several of the pins of the SDIO interface need pull-up resistors (33-47K) for the interface to function correctly. Please refer to any one of the many board schematics using SD and MicroSD sockets.

The CD and WP are switches to ground, they will need pull-up resistors to provide observable output.

You can, if you wish, ignore these pins, but you will need to modify the software to accommodate this, otherwise it will return a NOT PRESENT status when queried.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antonius
Senior
Posted on April 11, 2014 at 05:51

so it's not enough if I put 10K pull up ?

it was working fine previously but now it's intermittent, sometimes it's working, sometimes it's not,

is it because of 10K pull up resistor?

thanks

antonius
Senior
Posted on April 11, 2014 at 05:53

on usart :

-- SD card detected OK Trying to create file

1.
f_mount(0,&fs); 
2.
printf(''Trying to create file 
'');
3.
4.
res = f_open( &fsrc , ''test.TXT'' , FA_CREATE_ALWAYS | FA_WRITE);

antonius
Senior
Posted on April 11, 2014 at 05:56

res = f_open( &fsrc , ''Demo.TXT'' , FA_CREATE_NEW | FA_WRITE);   

this line doesn't give me a response ??

antonius
Senior
Posted on April 11, 2014 at 05:58


GPIO_InitTypeDef GPIO_InitStructure;


/*!< GPIOC and GPIOD Periph clock enable */

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | SD_DETECT_GPIO_CLK, ENABLE);


/*!< Configure PC.08, PC.09, PC.10, PC.11, PC.12 pin: D0, D1, D2, D3, CLK pin */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_Init(GPIOC, &GPIO_InitStructure);