cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 Mass Storage Class (MSC) Write to SD Card Not Saving

jacob2
Associate II
Posted on February 13, 2017 at 17:27

I'm working on a custom board with an STM32L476ZGT6 and set up code through the STM32CubeMX utility and followed along with the sample code for the eval board. I want to be able to copy files to the SD card when I connect my device and am able to get the connection and move the file to the SD Card and it will show up as being completed, however once I disconnect the device I lose the file. I've traced through the code and I do all the writes successfully, I just can't seem to save the file there once I unplug my device, any help would be greatly appreciated.

#usb-mass-storage #sd-card #sd #stm32l4
7 REPLIES 7
Oliver Beirne
Senior
Posted on February 13, 2017 at 17:38

Hi Kenny

I have moved your question to the

https://community.st.com/community/stm32-community/stm32-forum?sr=search&searchId=95f99036-6589-414c-9f47-bf38300414b4&searchIndex=0

‌ where someone should be able to help you.

Thanks

Oli

Posted on February 13, 2017 at 19:31

You need to make sure the file system structures get flushed to the media. On Windows this would mean closing the files, and then Ejecting (safely removing) so all local caching and write-back completes.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 13, 2017 at 19:36

As the move gets reported in the Inbox I'm not convinced of the value of this message. Someone 'might' be able to help posters, but it isn't a guarantee.

We might want to review the systemic reason people keep posting in the wrong places, and address that. I think it has to do with the somewhat muddled and overlapping views presented of content and posts.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 14, 2017 at 17:10

I close the files and then safely remove my device but still no luck on keeping the file on the SD card.

Posted on February 14, 2017 at 17:42

At that point you're left with analysing what has in fact been written to the media, and walking the file system structures.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Nor Sch
Associate III
Posted on February 15, 2017 at 11:07

Which Bus you use?

First I would connect a LogicAnalyzer (or at least an Oscilloscope). Look if there is something and try to interpret it. If you use SPI-Connection (avoid this for professional Solutions, it's removed from eMMC-Standard) it could be easy. With SDIO (normal SDMMC-Interface) it will be more difficult. For the commonly used Saleae-LogicAnalyzers exists a nonoffical Plugin for interpreting the CMD-Line of SD-Traffic. If you need to interpret also eMMC or the DataLines you will need an much more expansive Analyzer which is in most other Cases worse than the Saleae ...

Posted on February 15, 2017 at 17:10

If it validates properly at a block access level then the bus is not an issue. Step one is to determine what is being read, and is that structurally correct and consistent.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..