2014-04-10 03:36 AM
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 ? thanks2014-04-10 06:33 AM
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.2014-04-10 05:06 PM
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
2014-04-10 05:31 PM
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.2014-04-10 08:51 PM
2014-04-10 08:53 PM
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);
2014-04-10 08:56 PM
res = f_open( &fsrc , ''Demo.TXT'' , FA_CREATE_NEW | FA_WRITE);
this line doesn't give me a response ??2014-04-10 08:58 PM
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);