2012-08-07 09:55 AM
Hi everyone,
I am trying to send some bytes of data on a sd-card (8GB) using SPI.I started with wiring the sd slot and configuring the spi but I have nothing, not even the clock...I have followed what's explained in the file spi.h and seen other post about spi but I still don't see where I am wrong.I'd really appreciate if you can help me with it ! Thank you. #spi-sd-card-stm32-discovery2012-08-07 09:56 AM
Here is my code :)
________________ Attachments : main.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzqn&d=%2Fa%2F0X0000000bQh%2FDLASaW3Ci6MPCAQHPPKTsjz0o4dbIlrZpcUZpbrm9_I&asPdf=false2012-08-07 09:57 AM
2012-08-07 10:04 AM
RCC_APB2PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
Pick the correct APB2012-08-08 04:55 AM
Thanks Clive1 !
I just changed it but still nothing happens.2012-08-08 06:53 AM
I just changed it but still nothing happens.
Are you sure the SPI2 exits via the PD1, PD2 and PD3 pins? Doesn't look to be a valid routing. PI1, PI2 and PI3 look better candidates, or some PBx or PCx pins.2012-08-08 08:32 AM
Thanks for your help,
I don't have GPIO port I on stm32f4 discovery...But I manage to make my SD-Card in SDIO mode.I can send data to it and read it back. Now I would like to write my data in a way I could read it from my computer to put it in a excel file.I think I just can create a .txt file, right ?I downloaded your code about FATFs. From what I've understand so far, I need it to convert my data in Fat format in a file and then load it on the sd-card.Is that the idea ?Thank you.2012-08-08 09:37 AM
Or perhaps a .CSV file (comma separated entries in a text file)
You'd write the data into a file in much the same way as you'd do it with STDIO file functions.2012-08-08 10:09 AM
Ok, CSV file sound good !
So far I didn't use a DMA since I just store the data every time I need to.
Do I need to use a DMA if I want to store my data in a csv file ?
Do I need to create the .csv file in my STM32 memory and then load it on the card or can I create it in the card and then write the data in the .csv fie ?
Thanks ! :)I'm a bit lost in all the readings...
Thank you very much for your help !
2012-08-08 10:15 AM
Not sure how DMA plays into your particular circumstances.
I'd write the CSV file a line at a time, in much the same way I did with the DIR.TXT file I was creating in the FATFs example. It would be more efficient to buffer up larger blocks of data, but that might just over complicate things for you during initial development.