|
楼主 |
发表于 2024-4-23 16:56:11
|
显示全部楼层
现在能定位到是因为cache的开启原因导致的FR_INT_ERR错误,将AXI区域的cache关闭后就可以正常使用fatfs文件系统
DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
{
DRESULT res = RES_ERROR;
WriteStatus = 0;
uint32_t timeout;
#if (ENABLE_SD_DMA_CACHE_MAINTENANCE == 1)
uint32_t alignedAddr;
/*
the SCB_CleanDCache_by_Addr() requires a 32-Byte aligned address
adjust the address and the D-Cache size to clean accordingly.
*/
alignedAddr = (uint32_t)buff & ~0x1f;
SCB_CleanDCache_by_Addr((uint32_t*)alignedAddr, count*BLOCKSIZE + ((uint32_t)buff - alignedAddr));
#endif
if(BSP_MMC_WriteBlocks_DMA((uint32_t*)buff,
(uint32_t)(sector),
count) == MMC_OK)
{
/* Wait that writing process is completed or a timeout occurs */
timeout = HAL_GetTick();
while((WriteStatus == 0) && ((HAL_GetTick() - timeout) < SD_TIMEOUT))
{
}
/* incase of a timeout return error */
if (WriteStatus == 0)
{
res = RES_ERROR;
}
else
{
WriteStatus = 0;
timeout = HAL_GetTick();
while((HAL_GetTick() - timeout) < SD_TIMEOUT)
{
if (BSP_MMC_GetCardState() == MMC_TRANSFER_OK)
{
res = RES_OK;
break;
}
}
}
}
return res;
}
这里我无论使用4字节还是32还是64的都无法在开启cache的情况下正常使用,硬汉哥能给看看吗
|
|