This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

STM32F429 - microSD and SPI interface

Welcome,

Is there anybody who is using SD/microSD card by SPI interface on STM43F4xx? I think that latest updates changes something and it's not working anymore. But I have only 2 PCB from one project and I don't have time for tests now - I need working program ;/

Situation is like that:
- STM32F429; 32MB ExtRAM, GUI (LCD), 2xSD (SDIO, SPI4), USBFS (host/device), blebleble...
- 2 devices; hardware is OK.

First program was created about year ago (~July 2015) was working correctly (it has to because I was using card by SPI). It was compiled with:
- ARM:CMSIS: 4.2.0
- Keil:MDK-Middleware: 6.2.0
- Keil:STM32F4xx_DFP: 2.2.0

Because of some PC malfunction from that time I have only compiled data in my format (I can flash my boards and it's working). All source is from archives and (except SPI) it's working correctly. I don't have also Keil installation with exactly the same set of files. But from project file I read libraries versions.

In that year I created some other programs for that board but I didn't used SD by SPI so I don't know when it stopped working.

Now I need to recompile old code (some changes) and - doesn't matter what I do - card is not working (SPI card). I tried everything - even deleting all other libraries versions from Keil Packs. All other things are working OK (card by SDIO, USB host, USB device, GUI, RTOS...) and it doesn't matter on which libraries I'm using.
I even tried to delete all code and leave just SD test:

int main(void) {
  fsStatus fs;
  FILE *f;

  fs = finit("M0:");
  if(fs == fsOK) {
    fs = fmount("M0:");
    if(fs == fsOK) {
      f = fopen("M0:\\aaa", "w");
      fwrite(&fs, 1, 1, f);
      fclose(f);
    }
  }

  while(1);
}

I have found way out; it's temporary and incomplete:
1. set up libraries to:
- ARM:CMSIS: 4.5.0 (doesn't matter)
- Keil:ARM_Compilet:1.0.0
- Keil:MDK-Middleware: 7.0.0 (doesn't matter)
- Keil:STM32F4xx_DFP: 2.4.0 (<= 2.4.0 is working; newer - NOT)

2. in RTE_Device.h disable for SPI (SPI4 in my project)
3. run APB2 clock 2x slower
Normally I work on 168MHz, which gives APB2 max clock 84MHz. But I need to run it on 42MHz.

And it's working now. BUT - only normal SD cards. SDHC cards are NOT working.

One of my PCB is old and it was working with problematical program. And, as I wrote - it was working. So hardware should be OK.
As for me, STM32F4xx_DFP package is suspected. But I don't have enought hardware to check it. Also it would be strange - if it is broken for some time and nobody noticed it...

So, firstly I would like to thank you if you managed to read my horrible english ;p
Second - if anybody is using SD card on SPI interface on STM43F4xx please write something (libraries, configuration, whatever).

Aha - I have checked all items like stack, heap, clocks...