Skip to main content
ranciere
Associate II
August 25, 2021
Solved

File writing bug with FatFs over FreeRTOS on H743

  • August 25, 2021
  • 4 replies
  • 1332 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***

4 replies

Tesla DeLorean
Guru
August 25, 2021

memory alignment?

Shifted by 1-byte does seem a bit strange.

Buffer locked/protected from modification until the command completes?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ranciere
ranciereAuthor
Associate 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?

ranciere
ranciereAuthorBest answer
Associate 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***

ranciere
ranciereAuthor
Associate II
August 26, 2021