2016-05-11 02:34 PM
I have project generated by STM32CubeMX 4.14.0 and STM32CubeF7 1.3.1. I use the FATFS and SDIO with DMA.
If I wrote a file with higher clock for sd card, then there is an error in the function FR_DISK_ERR f_write.
I found the problem in sd_diskio.c where
SD_read and SD_write
functions call functions for polling mode and not for DMA mode.For DMA mode is necessary to change:
DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
{ DRESULT res = RES_OK; if(BSP_SD_ReadBlocks_DMA
((uint32_t*)buff, ((uint64_t)
sector * BLOCK_SIZE), BLOCK_SIZE, count) != MSD_OK) DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) { DRESULT res = RES_OK; if(BSP_SD_WriteBlocks_DMA
((uint32_t*)buff, ((uint64_t)
sector * BLOCK_SIZE), BLOCK_SIZE, count) != MSD_OK)2016-05-12 03:05 AM
Hi petr.k,
Thank you for the feedback. It's reported internally. -Hannibal-2017-01-23 03:11 AM
STM32CubeMX 4.19.0 and STM32CubeF7 1.6.0
No change
, the
STM32CubeMX still has this bug !
ST team,
try to
do
your
examples
using
STM32CubeMX
,
you may find
yourself
bugs
faster.2017-01-23 04:53 AM
Dear petr.k
SD and MMC(perhaps other peripheral) driver is still unmatured.
I mentioned in this thread.
https://community.st.com/0D50X00009Xkg1RSAR
For now,we should customize source codes by ourself as we like.
2017-01-23 06:57 AM
Hi
Kolomaznik.Petr
,The issue is already tracked internally.
It is not directly related to CubeMX generated code, but the fix has to be applied in the Third_Party FatFS driver.
Sorry for such inconvenience.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-01-23 06:59 AM
Hi
Nemui.Trinomius
,SD and MMC(perhaps other peripheral) driver is still unmatured.
Is you comment applicable for the new driver available in the package version 1.6.0 of the STM32CubeF7?
If yes, please share your feedback providing all required details to explain it in a separate discussion.
Thanks.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2017-01-24 03:17 AM
Hi
st.mcu
,thank you for answer.
I have a
problem with the
SD
card
that use
DMA
.
E.g.
it hangs
in a loop
where
timeout
is
1048 sec
(
17
minute ??
)
.
I
do not understand
why
such a long time
.Please verify
and check all modes of SD and FATFS that are contained inHAL
. It is a pity that such a great microcontrollers have poor software support.
#define SDMMC_DATATIMEOUT ((uint32_t)0x00100000U)
static uint32_t SD_FindSCR(SD_HandleTypeDef *hsd, uint32_t *pSCR)
{....
while(!__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXOVERR | SDMMC_FLAG_DCRCFAIL | SDMMC_FLAG_DTIMEOUT | SDMMC_FLAG_DBCKEND))
{ if(__HAL_SD_GET_FLAG(hsd, SDMMC_FLAG_RXDAVL)) { *(tempscr + index) = SDMMC_ReadFIFO(hsd->Instance); index++; } if((HAL_GetTick() - tickstart) >= SDMMC_DATATIMEOUT) { return HAL_SD_ERROR_TIMEOUT; } }Other minor
bug
:uint8_t FATFS_LinkDriverEx(Diskio_drvTypeDef *drv, char *path, uint8_t lun)
{ uint8_t ret = 1; uint8_t DiskNum = 0; if(disk.nbr <= _VOLUMES) // correctly if(disk.nbr < _VOLUMES) { disk.is_initialized[disk.nbr] = 0; disk.drv[disk.nbr] = drv; disk.lun[disk.nbr] = lun; DiskNum = disk.nbr++; path[0] = DiskNum + '0'; path[1] = ':'; path[2] = '/'; path[3] = 0; ret = 0; } return ret; }Petr