stm32f4 SDIO setup

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

Moderators: barthess, RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: stm32f4 SDIO setup

Postby Giovanni » Wed Mar 11, 2015 9:28 am

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

Postby daviddawe1982 » Wed Mar 11, 2015 12:30 pm

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: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: stm32f4 SDIO setup

Postby Giovanni » Wed Mar 11, 2015 1:21 pm

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

Postby daviddawe1982 » Thu Mar 12, 2015 1:07 pm

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: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: stm32f4 SDIO setup

Postby Giovanni » Thu Mar 12, 2015 1:28 pm

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

Postby daviddawe1982 » Thu Mar 12, 2015 2:35 pm

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

Postby daviddawe1982 » Thu Mar 12, 2015 2:37 pm

I also have long wires connecting the sd could that be a problem?

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: stm32f4 SDIO setup

Postby Giovanni » Thu Mar 12, 2015 2:41 pm

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

Postby daviddawe1982 » Fri Mar 13, 2015 2:26 pm

I have rebuilt my interface and now sdcConnect exits at Voltage detection..

User avatar
Giovanni
Site Admin
Posts: 13121
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 769 times
Been thanked: 653 times
Contact:

Re: stm32f4 SDIO setup

Postby Giovanni » Fri Mar 13, 2015 2:39 pm

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


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 6 guests