SDIO and SPI peripheral ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Guys,

Can I use the same SDcard for SDIO and SPI ?
Does anyone know which AVR can support SDIO ?

I used STM32 and I saw it's using SDIO...

Any ideas or experiences will be appreciated,

Thanks
 

Refer to the SDcard physical layer specification. SDcards are always supporting both interfaces. SDIO will be faster by using 4 data lines on standard cards. Multibit card interfaces can be found with high performance controllers like ARM9 or AVR32.
 

can I use this module with SDIO ?

is the same pin we used on SDcard ? only different on SPI and SDIO ?
**broken link removed**

Thanks

- - - Updated - - -

SDIO / SPI Pinout
 

Which cards are you talking about? I suspect a confusion of terms due to the sloppy usage of "SDIO" in some documents.

Strictly speaking we have this:

1. SD Memory cards
they offer two kinds of busses
1a. SD bus
1b. SPI bus

2. SDIO cards
Small peripheral devices, e.g. Bluetooth adapters using the same connector and bus as the SD memory cards.

They also support SPI and native SD bus.
 

Do any cards I have here can be used for SPI and SDIO ?

Please have a look at the attachment...
Does it mean I can use both interface with this application ?

it's : STM32F10xUSBLib2.21, and I want to try MassStorage application...
I have these init in one application :
inside msd.c
Code:
/*******************************************************************************
* Function Name  : SPI_Config
* Description    : Initializes the SPI1 and CS pins.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI_Config(void)
{
  GPIO_InitTypeDef  GPIO_InitStructure;
  SPI_InitTypeDef   SPI_InitStructure;

  /* GPIOA and GPIOC Periph clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC, ENABLE);
  /* SPI1 Periph clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);

  /* Configure SPI1 pins: SCK, MISO and MOSI */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  /* Configure PC12 pin: CS pin */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* SPI1 Config */
  SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
  SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
  SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
  SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
  SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_CRCPolynomial = 7;
  SPI_Init(SPI1, &SPI_InitStructure);

  /* SPI1 enable */
  SPI_Cmd(SPI1, ENABLE);
}

inside sdcard.c

Code:
/*******************************************************************************
* Function Name  : GPIO_Configuration
* Description    : Configures the SDIO Corresponding GPIO Ports
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
static void GPIO_Configuration(void)
{
  GPIO_InitTypeDef  GPIO_InitStructure;

  /* GPIOC and GPIOD Periph clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, 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);

  /* Configure PD.02 CMD line */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
  GPIO_Init(GPIOD, &GPIO_InitStructure);
}
 

Attachments

  • STM32F10xUSBLib2.21.rar
    1.7 MB · Views: 64

So I can use this card for SDIO and SPI as well, please see the attachment


and this module for SDIO ?
**broken link removed**

Thanks
 

Yes, the card will accessed in SPI mode, as with most small micros. You need an adapter to plug the micro-Sdcard into a standard socket.
 

I got the code from here :
**broken link removed**

How can I use it if USB port on my PCB are PA11 and PA12, I tried to find the configuration port on the code but couldn't find until now, may be you guys have experience,
thanks a lot.

So I will connect my module via SPI configuration ? and there's possibility to connect my module into SDIO peripheral as well ?
thanks
 

How can I connect CD ( pin11) on SDIO, I can't find it...or it's optional ?
thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…