2018-07-10 10:37 PM
Hello, I want to use micro SD card with SDI0 interface. but I don't find document. Could you help me? Thanks.
2018-07-10 11:10 PM
Probably covered by multiple documents. The card spec can't be published by ST, but you can review the SDIO peripheral description in the Reference Manual, and review the assorted examples. If you dig a little you should be able to find the SD Card Association docs.
This talks about the SPI interface, but the cards at a command level function the same, just you can push data over wider buses.
http://elm-chan.org/docs/mmc/mmc_e.html
STM32Cube_FW_F4_V1.21.0\Drivers\BSP\STM324x9I_EVAL\stm324x9i_eval_sd.c
STM32Cube_FW_F4_V1.21.0\Projects\STM324x9I_EVAL\Applications\FatFs\FatFs_uSD
STM32Cube_FW_F4_V1.21.0\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_sd.c
STM32Cube_FW_F4_V1.21.0\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_sdmmc.c
2018-07-11 01:31 AM
Thank you for answered. I try to work with stm32f429zı. I configured, but this did not work.
2018-07-11 01:45 AM
That's the chip, but what board? The STM32F429I-DISCO isn't really designed to interface an SD Card, one of the pins is used by the LCD RED bus. The NUCLEO-F429ZI has all the required pins on the 16-pin header.
2018-07-11 02:04 AM
If I use SDIO for 1B in STM32F429I -DISCO, It's pins enough. This pins are PD2, PC8 and PC12.
2018-07-11 04:30 AM
Hello, my configuration code is :
__HAL_RCC_SDIO_CLK_ENABLE();
//GPIOD : 2 (SDIO_CMD), //GPIOC : 12(SDIO_CLK), 8(SDIO_DO) //GPIOA : 8(CARD) __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE();GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = GPIO_AF12_SDIO; HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);hsd.Instance = SDIO;
hsd.Init.BusWide = SDIO_BUS_WIDE_1B; hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE; hsd.Init.ClockDiv = 0; hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING; hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; HAL_SD_ConfigWideBusOperation(&hsd,SDIO_BUS_WIDE_1B); if((HAL_SD_InitCard(&hsd))!=0) { Error_Handler(); }it stays
Error_Handler(); please help me ?
2018-07-11 08:49 AM
You should be able to initialize the SD in 1-bit mode, and then not reconfigure it.
It would probably take me a hour or two to port some working code to the F429I-DISCO, if you want to pick up the billable hours?
2018-07-12 02:25 AM
So, sould I wait ?
2018-07-12 03:36 AM
I'm not going to work on it speculatively, you'd need to make a reasonable offer for my time.
2018-07-15 11:50 PM
Hello, Thank you for answered. I solved this problem. I fixed this code below:
in stm32f4xx_it.c :
void DMA2_Stream3_IRQHandler(void)
{/* USER CODE BEGIN DMA2_Stream3_IRQn 0 *//* USER CODE END DMA2_Stream3_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_sdio_rx);/* USER CODE BEGIN DMA2_Stream3_IRQn 1 *//* USER CODE END DMA2_Stream3_IRQn 1 */
}/**
* @brief This function handles DMA2 stream6 global interrupt.*/void DMA2_Stream6_IRQHandler(void){/* USER CODE BEGIN DMA2_Stream6_IRQn 0 *//* USER CODE END DMA2_Stream6_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_sdio_tx);/* USER CODE BEGIN DMA2_Stream6_IRQn 1 *//* USER CODE END DMA2_Stream6_IRQn 1 */
}void SDIO_IRQHandler(void)
{//BSP_SD_ReadCpltCallback();HAL_SD_IRQHandler(&hsd);//__HAL_SD_CLEAR_IT(&hsd,SDIO_IT_SDIOIT);}
then, in HAL_SD_RxCpltCallback(hsd); in
HAL_SD_IRQHandler(&hsd)
__weak void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
{/* Prevent unused argument(s) compilation warning */BSP_SD_ReadCpltCallback();//UNUSED(hsd);/* NOTE : This function should not be modified, when the callback is needed,the HAL_SD_RxCpltCallback can be implemented in the user file*/}and same in
HAL_SD_TxCpltCallback(hsd); in
HAL_SD_IRQHandler(&hsd)
__weak void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
{/* Prevent unused argument(s) compilation warning */BSP_SD_WriteCpltCallback();// UNUSED(hsd);/* NOTE : This function should not be modified, when the callback is needed,
the HAL_SD_TxCpltCallback can be implemented in the user file*/}