lib/stm32/BSP/STM32F4xx-Nucleo/stm32f4xx_nucleo.c
void SD_IO_Init(void)
{
  GPIO_InitTypeDef  GPIO_InitStruct;
  uint8_t counter;

  /* SD_CS_GPIO Periph clock enable */
  SD_CS_GPIO_CLK_ENABLE();

  /* Configure SD_CS_PIN pin: SD Card CS pin */
  GPIO_InitStruct.Pin = SD_CS_PIN;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
  HAL_GPIO_Init(SD_CS_GPIO_PORT, &GPIO_InitStruct);

  /*------------Put SD in SPI mode--------------*/
  /* SD SPI Config */
  SPIx_Init();
  
  /* SD chip select high */
  SD_CS_HIGH();
  
  /* Send dummy byte 0xFF, 10 times with CS high */
  /* Rise CS and MOSI for 80 clocks cycles */
  for (counter = 0; counter <= 9; counter++)
  {
    /* Send dummy byte 0xFF */
    SD_IO_WriteByte(SD_DUMMY_BYTE);
  }
}
/********************************* LINK SD ************************************/
/**
  * @brief  Initializes the SD Card and put it into StandBy State (Ready for 
  *         data transfer).
  * @param  None
  * @retval None
  */
LINK SD
@brief  Initializes the SD Card and put it into StandBy State (Ready for
data transfer).
@param  None
@retval None
LINK SD @brief Initializes the SD Card and put it into StandBy State ( Ready for data transfer ) . @param None @retval None
void SD_IO_Init(void)
{
  GPIO_InitTypeDef  GPIO_InitStruct;
  uint8_t counter;
  SD_CS_GPIO_CLK_ENABLE();
  GPIO_InitStruct.Pin = SD_CS_PIN;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
  HAL_GPIO_Init(SD_CS_GPIO_PORT, &GPIO_InitStruct);
  SPIx_Init();
  SD_CS_HIGH();
  for (counter = 0; counter <= 9; counter++)
  {
    SD_IO_WriteByte(SD_DUMMY_BYTE);
  }
}
void SD_IO_Init ( void ) { GPIO_InitTypeDef GPIO_InitStruct ; uint8_t counter ; SD_CS_GPIO_CLK_ENABLE ( ) ; GPIO_InitStruct . Pin = SD_CS_PIN ; GPIO_InitStruct . Mode = GPIO_MODE_OUTPUT_PP ; GPIO_InitStruct . Pull = GPIO_PULLUP ; GPIO_InitStruct . Speed = GPIO_SPEED_HIGH ; HAL_GPIO_Init ( SD_CS_GPIO_PORT , & GPIO_InitStruct ) ; SPIx_Init ( ) ; SD_CS_HIGH ( ) ; for ( counter = 0 ; counter <= 9 ; counter ++ ) { SD_IO_WriteByte ( SD_DUMMY_BYTE ) ; } }
LINK SD
 @brief  Initializes the SD Card and put it into StandBy State (Ready for
         data transfer).
LINK SD @brief Initializes the SD Card and put it into StandBy State ( Ready for data transfer ) .
/* SD_CS_GPIO Periph clock enable */ /* Configure SD_CS_PIN pin: SD Card CS pin */ /*------------Put SD in SPI mode--------------*/ /* SD SPI Config */ /* SD chip select high */ /* Send dummy byte 0xFF, 10 times with CS high */ /* Rise CS and MOSI for 80 clocks cycles */ /* Send dummy byte 0xFF */