STMicroelectronics / STM32CubeF7

STM32Cube MCU Full Package for the STM32F7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
320 stars 191 forks source link

SD_read - SCB_InvalidateDCache_by_Addr issue #95

Closed Jason0926Ni closed 4 weeks ago

Jason0926Ni commented 1 year ago

When Buffer is not 32-byte aligned, SD_Read will invalidate the Data Cache according to the following code. When calculating alignedAddr, the program will add some extra memory addresses to the front, which will cause problems with the data in those memory addresses.

\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio_dma_rtos_template_bspv1.c \Middlewares\Third_Party\FatFs\src\drivers\sd_diskio_dma_rtos_template_bspv2.c


#if (ENABLE_SD_DMA_CACHE_MAINTENANCE == 1)
                /*
                the SCB_InvalidateDCache_by_Addr() requires a 32-Byte aligned address,
                adjust the address and the D-Cache size to invalidate accordingly.
                */
                alignedAddr = (uint32_t)buff & ~0x1F;
                SCB_InvalidateDCache_by_Addr((uint32_t*)alignedAddr, count*BLOCKSIZE + ((uint32_t)buff - alignedAddr));
#endif
TOUNSTM commented 1 year ago

Hello @Jason0926Ni ,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards,

ASELSTM commented 11 months ago

ST Internal Reference: 157163

TOUNSTM commented 4 weeks ago

Hello @Jason0926Ni,

First we would like to thank you for your report. In fact, alignedAddr is used only for cache invalidation, it is not used for buffer data read/write.

As this issue is invalid, please allow me thus to close this thread. Thank you for your comprehension.

With regards,