I have found the solution to this problem:
2 way (RX,TX) dma doesnt work, I dont known why...
But shared DMA channel yes but in BSP_driver_cd.c CubeMX doesnt generate propertly Write *** Read function.
in file bsp_driver_sd.c in function modify BSP_SD_WriteBlocks_DMA(...):
__weak uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
{
uint8_t sd_state = MSD_OK;
// Since we are only using 1 DMA channel for SDMMC
// Change DMA direction before calling SD Read
// Direction can only be changed when DMA is disabled
__HAL_DMA_DISABLE(hsd1.hdmatx);
hsd1.hdmatx->Init.Direction = DMA_MEMORY_TO_PERIPH;
hsd1.hdmatx->Instance->CCR |= (uint32_t)DMA_CCR_DIR;
/* Write block(s) in DMA transfer mode */
if (HAL_SD_WriteBlocks_DMA(&hsd1, (uint8_t *)pData, WriteAddr, NumOfBlocks) != HAL_OK)
{
sd_state = MSD_ERROR;
}
return sd_state;
}
in file bsp_driver_sd.c in function modify BSP_SD_ReadBlocks_DMA(...):
__weak uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
{
uint8_t sd_state = MSD_OK;
// Since we are only using 1 DMA channel for SDMMC
// Change DMA direction before calling SD Read
// Direction can only be changed when DMA is disabled
__HAL_DMA_DISABLE(hsd1.hdmarx);
hsd1.hdmarx->Init.Direction = DMA_PERIPH_TO_MEMORY;
hsd1.hdmarx->Instance->CCR &= ~DMA_CCR_DIR;
/* Read block(s) in DMA transfer mode */
if (HAL_SD_ReadBlocks_DMA(&hsd1, (uint8_t *)pData, ReadAddr, NumOfBlocks) != HAL_OK)
{
sd_state = MSD_ERROR;
}
return sd_state;
}
Solution first posted superspud9 on reddit.
thanks