2019-05-31 05:18 AM
I have spent a couple weeks trying to get this working, reading many ST threads about many quickfixes to get this to work on various stm32 chip versions. Ive had no real luck other than seeing some details about the SD Card like its size. Stm32CubeMX is pretty nice for some things but for this case its not so nice. (Example. The FATFS option "Use DMA template" breaks DMA evidently, yet I havent seen any FATFS DMA work so its just another undocumented piece of what the heck is this)
The non DMA version works. Which is great, but the DMA example uses RTOS which I dont believe I want.
32L496GDISCOVERY\Applications\FatFs\FatFs_uSD_Standalone
I tried to convert this project that looked like what I need, but I could not change the micro in stmcubeIDE due to it being greyed out and my porting attempt failed. The readme text file says its easy to port the project to another micro but I could find no documentation on where/how this "easy" process takes place. So into the dark failed porting I've been.
STM32L4R9I-EVAL\Applications\FatFs\FatFs_uSD_DMA_Standalone
Could someone help get me out of the Twilight Zone? This is my first attempt with STM32 and it been very very rough so far compared to generating the base code with Atmel Start for the SamL21.
Looking for fully working sample test code with all the getchas removed that does a DMA write and DMA read to the SDMMC using the FAT library. Code that shows how you would read a large file from the SD card 1 block at a time efficiently. And code for piping multiple blocks of data to a file on the SD card..
Something that has all the interrupts and settings already set like for the half/full DMA buffer Interrupts.
Is there a better tool to generate sample code for the STM32L4 than CubeMX?
Should I just learn RTOS and use that for the SDMMC DMA?
Thanks
2019-05-31 07:50 AM
Had a NUCLEO-L496ZG working with SDMMC w/DMA on Keil here, bare metal, no RTOS.
CubeMX is pretty worthless, I'm using the HAL examples as a starting point. Takes a lot of time/effort.
>>Code that shows how you would read a large file from the SD card 1 block at a time efficiently.
About the least efficient possible method, command overhead dominates. Make sure the IO is block aligned, read as many as possible.
2019-06-01 03:47 AM
Thanks for the reply, I guess this tells me that others have found CubeMX / the code examples to be not so good / terrible.
Any chance you could share your code?? Thanks!
2019-06-01 05:47 AM
I'm open to offers.
2019-06-01 01:55 PM
I'll give you a solid high five and I'm sure thousands of others like me would also be down. ST should prob give you some cash for the the example code for their hardware.
2019-06-04 08:02 PM
Found some decent success, posted code here.
2021-07-26 11:24 AM
I have a STM32L476RCT6 interfaced to micro-SD SDMMC trying to run FATFS, Bear Metal. Do you have anything that works - It would be appreciated.