Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD_read - SCB_InvalidateDCache_by_Addr issue #95

Open
Jason0926Ni opened this issue Jun 2, 2023 · 2 comments
Open

SD_read - SCB_InvalidateDCache_by_Addr issue #95

Jason0926Ni opened this issue Jun 2, 2023 · 2 comments
Assignees
Labels
bug Something isn't working fatfs FatFs-related issue or pull-request fs File system-related issue or pull-request internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request.

Comments

@Jason0926Ni
Copy link

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

@Jason0926Ni Jason0926Ni changed the title SD_read in sd_diskio.c fails with DMA in cached memory areas SD_read - SCB_InvalidateDCache_by_Addr issue Jun 2, 2023
@TOUNSTM
Copy link
Contributor

TOUNSTM commented Jun 2, 2023

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,

@TOUNSTM TOUNSTM assigned TOUNSTM and ASELSTM and unassigned TOUNSTM Jun 2, 2023
@ASELSTM
Copy link
Contributor

ASELSTM commented Jul 12, 2023

ST Internal Reference: 157163

@ASELSTM ASELSTM added internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request. fatfs FatFs-related issue or pull-request labels Jul 12, 2023
@ASELSTM ASELSTM moved this from To do to In progress in stm32cube-mcu-fw-dashboard Jul 12, 2023
@ALABSTM ALABSTM added the fs File system-related issue or pull-request label Aug 1, 2023
@ALABSTM ALABSTM added the bug Something isn't working label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fatfs FatFs-related issue or pull-request fs File system-related issue or pull-request internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request.
Projects
Development

No branches or pull requests

4 participants