2018-01-05 02:33 PM
The HAL_SD_ErrorCallback() is called EVERY time a one sector DMA Write is used
ie
SD_state = BSP_SD_WriteBlocks_DMA((uint32_t *)buff, sector, count); // With count == 1
void SDMMC1_IRQHandler(void)
{ HAL_SD_IRQHandler(&hsd_discovery); // Calls the handler}Here is the offending code in STM32L4xx_hal_sd.c, errorstate is 4 CMD_RSP_TIMEOUT
void HAL_SD_IRQHandler(SD_HandleTypeDef *hsd)
{...
else if((hsd->Context & SD_CONTEXT_DMA) != RESET) {#if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) hsd->Instance->DLEN = 0; hsd->Instance->DCTRL = 0; hsd->Instance->IDMACTRL = SDMMC_DISABLE_IDMA;/* Stop Transfer for Write Single/Multi blocks or Read Multi blocks */
if((hsd->Context & SD_CONTEXT_READ_SINGLE_BLOCK) == RESET) { errorstate = SDMMC_CmdStopTransfer(hsd->Instance); if(errorstate != HAL_SD_ERROR_NONE) { hsd->ErrorCode |= errorstate; HAL_SD_ErrorCallback(hsd); } }...
It ends up here, and if I call Error_Handler(), basically GAME OVER
/**
* @brief SDMMC error callback * @param None * @retval None */void HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd){ puts('HAL_SD_ErrorCallback');}Getting 10.1 MBps Write Speeds, and 12.2 Read Speeds in current testing
2018-01-06 10:21 AM
Clive isn't this where you or one of there other gurus would normally post something like 'I don't use HAL'. Lol
2018-01-07 06:06 AM
HAL is now a requirement...
:)
Soon it will be so HAL-centric around here that you won't be able to sustain your guru status anymore without using HAL effectively.
2018-01-07 07:03 AM
In a world full of Cargo Cult Programmers the guy that can find his own pants and put them on will always appear to be a genius.
2018-05-17 08:15 AM
Hello
Turvey.Clive.002
,Thanks a lot foryour contribution andhighlighting this issue.
We confirm thatthe 'Stop Transfer' command should be sent only in case of multiple read or write, not single write.
This will be fixed in the coming version.
With Regards,
Imen.
2018-08-09 03:06 AM
Hello @Community member ,
The HAL SD driver within the new CubeL4 version 1.12.0, fixed the DMA write issue and send the "Stop transfer" command only in case of multiple read or write operations.
With Regards,
Imen.