2019-11-11 10:49 PM
Hi all,
I am using STM32CUBEMX to build a project which includes eMMC and FATFS .
Then I try to format and read the eMMC like down below.
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
It always stuck in HAL_GetTick() and return the print Timeout error.
------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------
The f_mount pass ,but f_mkfs and f_opendir return FR_DISK_ERROR everytime.
I have checked the hardware initial and HAL setting, I`m not sure where I should to set.
If you need any detail ,I will show you.
Hope anyone can help!
Thanks a lot !!
New Topic on:https://community.st.com/s/question/0D50X0000BcSNexSQG/emmc-on-stm32h743-always-disk-error
Thanks!
2019-11-12 05:32 PM
Is there anyone can help?
I`ll really appreciate.
2019-11-12 06:23 PM
Not using CubeMX here, so insight rather limited there.
Assuming this is on an H7
The H7 needs cache coherency code with DMA. The F7 in DTCMRAM does not.
Check if the DMA address is on a 32-byte boundary.
If it is going into a FatFs structure the InvalidateDCache_by_Addr is still unduly broad, and destructive.
2019-11-12 06:31 PM
@Community member Thanks for your reply.
Mine is H7 series, what does DMA address on 32-byte boundary mean?
I just search from my code down below, is this you mean about?
It`s in "core_cm7.h" file.
/**
\brief D-Cache Invalidate by address
\details Invalidates D-Cache for the given address
\param[in] addr address (aligned to 32-byte boundary)
\param[in] dsize size of memory block (in number of bytes)
*/
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr (uint32_t *addr, int32_t dsize)
{
#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
int32_t op_size = dsize;
uint32_t op_addr = (uint32_t)addr;
int32_t linesize = 32; /* in Cortex-M7 size of cache line is fixed to 8 words (32 bytes) */
__DSB();
while (op_size > 0) {
SCB->DCIMVAC = op_addr;
op_addr += (uint32_t)linesize;
op_size -= linesize;
}
__DSB();
__ISB();
#endif
}
2019-11-12 06:38 PM
>>what does DMA address on 32-byte boundary mean?
It means how is the buffer aligned in memory. You've got an address, how is it aligned? Is it cleanly divisible by 32, or NOT?
The cache line unit used by InvalidateDCache_by_Addr is 32-bytes.
ST is using the function without fully understanding the ramifications, and secondary effects.
2019-11-12 09:55 PM
@Community member I understand that ,but when I use the same way for SDCard,it can work.
Is it different setting to eMMC or something I need to notice?
2019-11-14 06:18 PM