2015-09-03 09:35 AM
Greetings all,
recently I am struggling with interfacing myhttp://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419
with a 2 GB SD card (via ) with SPI & FatFS. I have tried to modify examples from Geoffrey Brown'shttp://www.cs.indiana.edu/~geobrown/book.pdf
, as well ashttp://stm32f4-discovery.com/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/
, but both unsuccessful (I am relatively new to embedded coding). I would like the microcontroller to write lines of text (measurements) into a text file on the SD card. Does anyone happen to have a working example that could help me with my project, prefereably for the board I use? Thank you very much. Kind regards, James C2015-09-03 10:17 AM
The examples, and I've posted a lot of them here, for the STM32F4-DISCO use SDIO because SPI is just a ridiculously slow way of connecting, and why you really don't see a lot of examples of it being used.
The examples include a socket wire-wrapped onto an STM32F4-DISCO, and using an STM32F4-DIS-BB breakout board.2015-09-03 11:29 AM
Thank you for your reply. After a Google search I came across [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20sdio%20sdhc%204gb%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=102]this thread and
. Currently I only have the before mentioned SD card SPI module at hand, with pins: gnd, vcc, miso, mosi, sck, sdcs. Is it possible to use your SDIO example with my current configuration, or will I have to wait and get myself an SDIO breakout module? Thank you and kind regards, James C2015-09-03 07:59 PM
Unfortunately the image of the module gives me little insight into what you've actually got, or how the modules's PCB is wired up. Please cite something with a part number or diagram.
The SD card has very few pins, given the size of the pin header I'd have to assume most everything is connected, and at the very least you could get 1-bit SDIO functional. You'd have to decipher the pin naming/connectivity.2015-09-03 11:24 PM
Hi james.c,
you tried example from me, stm32f4-discovery.com website.I would like to know what didn't worked for you?If you mounted card OK but were unable to open file, that's probably because my FATFS modification (ffconf.h) uses dynamic allocation for file name using malloc, so you need enough heap. If this failed, f_open should return you FR_NOT_ENOUGH_CORE result.2015-09-04 04:01 AM
I will reply both of you in this post:
@clive1 About the module - pairs in 8x2 pin header are connected, which leaves 8 pins. And of those 2 are gnd and 2 are vcc (3,3 and 5 V). The schematic on the module suggests SPI pins correspond to SD interface as follows: miso->dat0 gnd->gnd sck->clk 3.3V->vcc gnd->cmd mosi->dat3 cs->dat2 After comparing to schematics on Wikipedia article on SD cards, I am not too confident about the accuracy of these. So I am thinking about resorting to something in thehttp://cdn.instructables.com/FHX/CDNZ/FYAJCAIZ/FHXCDNZFYAJCAIZ.MEDIUM.jpg
. Can you tell, from the ''pinout,'' whether I can use the 1-bit SDIO interface and your example? @majele.tilen I ''placed'' LEDs after specific parts of code to monitor the code execution. And even if (f_mount(&FatFs, ''0:'', 1) == FR_OK) doesn't succed. So the execution then ends in while(1) loop. My defines were SPI1, TM_SPI_PinsPack_2 and FATFS_USE_SDIO 0.