Skip to content

SD DMA Driver - SD_DMATransmitCplt not workΒ #41

@Emiya0306

Description

@Emiya0306

In this line, SD_DMATransmitCplt function is not transmit the data, just block in the function. We need fix the code like this:

/**
  * @brief  DMA SD transmit process complete callback
  * @PAram  hdma: DMA handle
  * @retval None
  */
static void SD_DMATransmitCplt(DMA_HandleTypeDef *hdma)
{
  SD_HandleTypeDef* hsd = (SD_HandleTypeDef* )(hdma->Parent);
	uint32_t errorstate;
	
	/* Send stop command in multiblock write */
  if(hsd->Context == (SD_CONTEXT_WRITE_MULTIPLE_BLOCK | SD_CONTEXT_DMA))
  {
    errorstate = SDMMC_CmdStopTransfer(hsd->Instance);
    if(errorstate != HAL_SD_ERROR_NONE)
    {
      hsd->ErrorCode |= errorstate;
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
      hsd->ErrorCallback(hsd);
#else
      HAL_SD_ErrorCallback(hsd);
#endif
    }
  }
	
	/* Disable the DMA transfer for transmit request by setting the DMAEN bit
  in the SD DCTRL register */
  hsd->Instance->DCTRL &= (uint32_t)~((uint32_t)SDIO_DCTRL_DMAEN);

  /* Clear all the static flags */
  __HAL_SD_CLEAR_FLAG(hsd, SDIO_STATIC_DATA_FLAGS);

  hsd->State = HAL_SD_STATE_READY;
  hsd->Context = SD_CONTEXT_NONE;

#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
  hsd->TxCpltCallback(hsd);
#else
  HAL_SD_TxCpltCallback(hsd);
#endif
}

Metadata

Metadata

Assignees

Labels

halHAL-LL driver-related issue or pull-request.needs clarificationNeeds clarification or inputs from the usersdSecure Digital interfacesdmmcSecure Digital input/output Multimedia Card interface

Projects

Status

Analyzed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions