stm32f4 SDIO setup

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: stm32f4 SDIO setup

Post by Giovanni »

That means that there is a DMA conflict, you are using another driver that uses the same DMA channel, please verify in mcuconf.h.

Giovanni
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: stm32f4 SDIO setup

Post by daviddawe1982 »

Yes it is using the same DMA stream as SPI1 TX = STM32_DMA_STREAM_ID(2, 3)
I have an lcd connceted to SPI1
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: stm32f4 SDIO setup

Post by Giovanni »

Some peripherals can be relocated on other DMA channels, see the STM32 RM in the DMA section, you can change mcuconf.h in order to do that.

Giovanni
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: stm32f4 SDIO setup

Post by daviddawe1982 »

So I got the DMA working and now the code does not stop but i still can not connect to the card.
How can I see what the error is with sdcConnect??
Below is my test code and it is printing..
Card Inserted.
Connecting...
Failed.

Code: Select all

sdcStart(&SDCD1, &sdccfg);
   gdispClear(Black);

   if (!blkIsInserted(&SDCD1)) {
      line1 = "Card not inserted, aborting.";
      fheight1 = gdispGetFontMetric(font1, fontHeight)+2;
      gdispFillStringBox(0, 0, widthB,  fheight1, line1, font1, White, Black, justifyCenter);
   }else{
      line1 = "Card inserted.";
      gdispFillStringBox(0, 0, widthB,  fheight1, line1, font1, White, Black, justifyCenter);

     }
      line1 = "Connecting...";
      fheight1 = gdispGetFontMetric(font1, fontHeight)+2;
      gdispFillStringBox(0, (fheight1*2), widthB,  fheight1, line1, font1, White, Black, justifyCenter);
           if (sdcConnect(&SDCD1)) {
           line1 = "Failed.";
           gdispFillStringBox(0, (fheight1*3), widthB,  fheight1, line1, font1, White, Black, justifyCenter);
     }else{
           line1 = "Connected.";
            gdispFillStringBox(0, (fheight1*3), widthB,  fheight1, line1, font1, White, Black, justifyCenter);


     }
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: stm32f4 SDIO setup

Post by Giovanni »

The best way is to step into the sdcConnect() and see where it fails. Provide the point and the state of relevant variables in that section of code.

Giovanni
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: stm32f4 SDIO setup

Post by daviddawe1982 »

It looks like it fails just after card 2.0 detection and hits
return HAL_FAILED;
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: stm32f4 SDIO setup

Post by daviddawe1982 »

I also have long wires connecting the sd could that be a problem?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: stm32f4 SDIO setup

Post by Giovanni »

Definitely, it alredy happened to some users. You need short wires, terminations, bypass caps etc.

Giovanni
daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: stm32f4 SDIO setup

Post by daviddawe1982 »

I have rebuilt my interface and now sdcConnect exits at Voltage detection..
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: stm32f4 SDIO setup

Post by Giovanni »

That would be the very first command sent. I think it is a problem at interface level, the board setup probably, you need to make sure that:
1) The SDIO pins are not connected to other thing on the board.
2) That each SDIO pin is configured correctly in board.h.
3) That each SDIO signal is assigned to only one pin (multiple pins would conflict internally).

Giovanni
Post Reply