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
322 stars 191 forks source link

Fix HAL_SD_ReadBlocks() working without -Os optimization flag #43

Closed anton-bondarev closed 2 years ago

anton-bondarev commented 3 years ago

There is trouble when I use HAL_SD_ReadBlocks() without compiler optimization flag -Os.

It seems that FIFO can overflow if we pass all checkings. After I added 'continue;' after reading a pack from FIFO the trouble seems disappeared

RKOUSTM commented 3 years ago

Hi @anton-bondarev,

First of all, we would like to thank you for your contribution. We tried to reproduce the issue you described, but we couldn't notice the problem. Could you please give us more details about your problem in order to allow a better analysis of the proposed fix and could you please give us the name of the project that is used to reproduce this issue.

Thank you again for your contribution.

With regards,

anton-bondarev commented 3 years ago

Hi @RKOUSTM

I've checked the trouble on one of the standard examples for STMF769i-discovery. I modified it to using BSP_SD_ReadBlocks () instead of BSP_SD_ReadBlocks_DMA() and turn off compiler optimization (use -O0 instead -Os) But I don't remember what exactly example I used

I ran into the problem while working on the SD-Card driver in Embox RTOS. You can reproduce the trouble in it. For this purpose, you have to configure Embox for stm32f769i-discovery (there is the same trouble for several other platforms STM32F7 and STM32F4)

make confload-platform/stm32/f7/stm32f769i-discovery

Switch the SD card driver to no dma mode adding option (use_irq=false) to stm32f769i_discovery_sd

    @Runlevel(2) include embox.driver.sd.stm32f769i_discovery_sd(use_irq=false)

And remove changes from a patch. I mean 'third-party/bsp/stmf7cube/cube/sd_read.patch' must be empty.

Then you should build an image

make

load to a board and try to read any SD card for example with 'dd' command

RKOUSTM commented 2 years ago

Hi @anton-bondarev,

Thank you for your reports. After investigation, this issue is related to user case and not directly related to the firmware published in this repository. For any other issue (e.g. related to documentation, to hardware, to ecosystem, to user application, etc.), you shall address your questions to the ST Community. There you shall look for the adequate topic and submit your question or remark.

Please allow me then to close this thread. Thank you for your comprehension and thank you again for your reports.

We are looking forward to reading from you again.

With regards,