Skip to main content
Visitor II
August 25, 2021
Solved

File writing bug with FatFs over FreeRTOS on H743

  • August 25, 2021
  • 3 replies
  • 1305 views

Hi!

I would like to store files on an SD card that are transmitted via HTTP POST (lwIP HTTP server). The files are correctly transmitted (hash calculating on both sides, the hashes are equal) and then written out to the card. But the content of the file is wrong: there is an additional byte before my content (and the last byte is missing, e.g. the file size is correct).

I've checked the data in the HAL_SD_WriteBlocks_DMA method before write, and everything is correct.

The cache maintenance (ENABLE_SD_DMA_CACHE_MAINTENANCE) macro is also defined. (And 1-byte offset bug cannot be by cache miss).

Another interesting thing it seems to be somehow timing related.

What can I check?

Regards,

    This topic has been closed for replies.
    Best answer by ranciere

    This ST code base is a joke. Of course I ran into other problems immediately:

    https://community.st.com/s/question/0D53W0000055hTvSAI/bug-errors-in-template-for-sddiskioc-in-stm32cubemx-5601

    and this:

    https://community.st.com/s/question/0D50X0000ArVPjuSQG/hal-bug-sddiskiodmatemplate-in-stm32cubefwf4v1241

    How is it possible to publish such a garbage which contains 2 years old bugs? It doesn't even compile and after fixing doesn't run ;(

    ***Moderation Edit: while the negative feedback is welcome, please refrain from using curse words or inflammatory language as it goes against the Community Ground Rules***

    3 replies

    Graduate II
    August 25, 2021

    memory alignment?

    Shifted by 1-byte does seem a bit strange.

    Buffer locked/protected from modification until the command completes?

    ranciereAuthor
    Visitor II
    August 26, 2021

    You are right, thanks a lot! I debugged and it was a memory alignment issue. BUT: why doesn't the driver complain in any form? Assert? Exit? It is very annoying! How can I ask feature from the FW developers?

    ranciereAuthorAnswer
    Visitor II
    August 26, 2021

    This ST code base is a joke. Of course I ran into other problems immediately:

    https://community.st.com/s/question/0D53W0000055hTvSAI/bug-errors-in-template-for-sddiskioc-in-stm32cubemx-5601

    and this:

    https://community.st.com/s/question/0D50X0000ArVPjuSQG/hal-bug-sddiskiodmatemplate-in-stm32cubefwf4v1241

    How is it possible to publish such a garbage which contains 2 years old bugs? It doesn't even compile and after fixing doesn't run ;(

    ***Moderation Edit: while the negative feedback is welcome, please refrain from using curse words or inflammatory language as it goes against the Community Ground Rules***

    ranciereAuthor
    Visitor II
    August 26, 2021