2018-10-24 03:15 PM
Hi, pretty sure this is a newbie type question. I'm using the SDMMC interface on an STM32L476. Right now it is just wired to a Nucleo board so I can do some benchmarking before committing it to a layout. I'm using STM32CubeMX and following the example in section 3.3 of UM1721 (Fatfs on CubeMX). After learning the hard way pullup resistors *are* necessary (some other posts said not), I am able to talk to a card, but only if I use polled mode ("Use DMA Template" set to disable in STM32CubeMX Fatfs settings). When enabled, the code hangs in the sd_diskio_dma.c SD_Read() routine right after the BSP_SD_ReadBlocks_DMA() call.
The note for "Use DMA Template" says to ensure that DMAs are properly configured but no more info. In the SDMMC configuration I've tried tried selecting SDMMC1 and then both SDMMC1_TX_SDMMC1_RX. I always get the stall. I am sure there i something basic I'm missing, but been at it for a couple days now and deciding to ask. Since this seems a very basic "follow the app note", rationalizing it might be useful for others too.
I've only recently migrated from the basic StcPeriph libraries to STMCube, starting with the LL routines, this is my attempt using HAL.
will
2018-10-27 09:59 AM
The level conversion on the SparkFun board isn't helpful on STM32 designs. These things from WaveShare, have pull-ups and work better
Supports Full-Size and Micro form factors
https://www.waveshare.com/sd-storage-board.htm
Micro only
https://www.waveshare.com/micro-sd-storage-board.htm
The ViewTool versions also work well
http://viewtool.com/index.php/en/36-2016-09-26-03-58-56/111-ficus-sd
There are some other cheap and nasty things on eBay, etc
2018-10-27 10:17 AM
I don't use CubeMX, it is a time saving tool that wastes time in my universe.
I'm using the HAL examples as a basis for the things, and have Polled and DMA variants working on assorted STM32 platforms, non-RTOS. I can also support eMMC (4-128GB modules tested), and have validated functionality out to 200-400GB cards. Got a lot of time and resources invested, so code only being shared with clients.
2018-10-27 11:09 AM
With my current state of the design, I cannot get the eMMC working beyond 8 Mhz clock (still using only 1 data wire for now).
2018-10-27 12:43 PM
Clive:
OK, understand your situation, thanks.
will
2018-10-27 12:52 PM
Lucasz:
Sky-wiring is tricky. To me it is only good for some basic verification work and not much beyond that before going to a board. Even at slow speeds, if the transitions are high speed you can still get ringing. My wires are quite a bit shorter and looking at the signals with my scope show that they are far from clean.
Being able to get 17Mbps with this far-from-ideal setup just gives me confidence that once I go to a PCB with a ground plane and both series and pullup resistors to get clean signals, bandwidth can only go up. My test was with 24MHz divided by 4 (6MHz) too, but was able to get 4-bit mode working. If you have a scope, might be worth checking D1-D3 to see if maybe something is obviously not-pretty.
will
will
2018-10-27 12:56 PM
2018-10-27 03:15 PM
they are very thick wires, do you have any wirewrap wire ?
too hard to retro fit... which eMMC chip are you using ?
I can whip up a daughter board for you...
2018-10-27 05:45 PM
Attaching the test app for SD card on NUCLEO-L476RG, outputs diagnostic and menu on VCP at 115200 8N1
2018-10-27 05:48 PM
This was Lukasz's eMMC dongle for the NUCLEO-144 boards, also readable using a full size SD Card socket, which is what I was using today on the NUCLEO-64
2018-11-01 03:15 PM
Just to let folk know: I'm still working on the root issue. I have confirmed that the stall is because there is no DMA happening at all, not because the DMA finished and the end isn't somehow being flagged. I also need a DMA-driven DAC for this project. Since I am pretty sure the "something basic" I'm missing has to do with DMAs, I'm going to fiddle withe the simpler peripheral (the DAC over SDMMC) to see what is wrong. Hopefully any lesson learned from the DAC DMA setup wil be applicable to the SDMMC DMA setup.
will