STM32F4DIS-BB anyone? at least SD card...

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

Moderators: barthess, RoccoMarco

User avatar
russian
Posts: 321
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 14 times
Been thanked: 7 times

STM32F4DIS-BB anyone? at least SD card...

Postby russian » Fri Mar 01, 2013 4:35 am

Did anyone get STM32F4DIS-BB 'baseboard' SD card slot running with ChibiOS?

Where do I start configuring the SDC Driver in SDIO mode (the one with four data lines)?
PB15 NCD

PC8 DAT0
PC9 DAT1
PC10 DAT2
PC11 DAT3

PC12 SDIO_CK
PD2 SDIO_CMD

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: STM32F4DIS-BB anyone? at least SD card...

Postby Tectu » Fri Mar 01, 2013 6:28 am

You might want to check out the applications in the demos directory of the ChibiOS/RT repo. For example, the OLIMEX_STM32_E407 demo shows how to use SDIO with an F407. The pin config is done in the board.h file in the corresponding boards/ directory. If your board doesn't exist yet, you have to create one yourself.
I hope this helps.


~ Tectu

User avatar
russian
Posts: 321
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 14 times
Been thanked: 7 times

Re: STM32F4DIS-BB anyone? at least SD card...

Postby russian » Fri Mar 01, 2013 9:08 pm

Tectu wrote:You might want to check out the applications in the demos directory of the ChibiOS/RT repo. For example, the OLIMEX_STM32_E407 demo shows how to use SDIO with an F407. The pin config is done in the board.h file in the corresponding boards/ directory. If your board doesn't exist yet, you have to create one yourself.

It took me some time to realize that these are in the unstable branch, but I have finally found them. Thank you for the hint!

User avatar
russian
Posts: 321
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 14 times
Been thanked: 7 times

Re: STM32F4DIS-BB anyone? at least SD card...

Postby russian » Sun Mar 03, 2013 3:35 am

OLIMEX_STM32_E407, board.h gives me proper configuration for the GPIOC port pins, is this all I need? How does the driver know if it should use single-line MOSI or the four-line D* mode? Or it does not, because that's taken care by setting proper AF modes on the pins? I guess I just do not get the difference between these two schematics. Is one MMC specific and other SD specific?

So far my code is hanging with just the adjustment of C port right at the 'sdc_lld_send_cmd_none(sdcp, MMCSD_CMD_GO_IDLE_STATE, 0)' command

User avatar
russian
Posts: 321
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 14 times
Been thanked: 7 times

Re: STM32F4DIS-BB anyone? at least SD card...

Postby russian » Wed Mar 13, 2013 3:35 am

What can I say... It took me six months to connect an external sd card module to my STM32F4Discovery
Two lessons:
1) if you connect an external module with some wires, this would not work with full speed SPI - and unfortunately too many samples assume a dev board with build-in slot
2) looks like three wire SPI mode is called mmc, not sd...

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: STM32F4DIS-BB anyone? at least SD card...

Postby Tectu » Wed Mar 13, 2013 10:38 am

I'm glad to hear that you finally got it working. This means that the SD card on the BB is connected over SPI, not SDIO?


~ Tectu

User avatar
russian
Posts: 321
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 14 times
Been thanked: 7 times

Re: STM32F4DIS-BB anyone? at least SD card...

Postby russian » Wed Mar 13, 2013 12:37 pm

Tectu wrote:This means that the SD card on the BB is connected over SPI, not SDIO?


Nope, it's just me confusing everyone :) BB board uses SDIO, but I did not get it working with Chibios. What I got working with Chibi was a small SPI SD pin-out module.

chiVelle
Posts: 21
Joined: Sun Aug 25, 2013 4:16 pm

Re: STM32F4DIS-BB anyone? at least SD card...

Postby chiVelle » Wed Dec 04, 2013 4:34 pm

I am having a similar issue with the breakout board for the STM32F4. I am attempting to talk to the sdcard over SDIO using the HAL interface but I am consistently getting the FatFS return code of FR_DISK_ERR : An unrecoverable error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function.

SdcIsCardInserted() and sdConnect() both return success, as well as f_mount. When calling f_open is where the FR_DISK_ERR code happens. Looking at the alternate function table for the STM32F4 tells me that the following pins need alternate mode 12, is this correct for SDIO? I have attached the Pin schematic for the SDcard on the breakout board. Any help is appreciated!

Code: Select all

palSetPadMode(GPIOC, 8, PAL_MODE_ALTERNATE(12) );    // SDIO_D0
palSetPadMode(GPIOC, 9, PAL_MODE_ALTERNATE(12) );   // SDIO_D1
palSetPadMode(GPIOC, 10, PAL_MODE_ALTERNATE(12) );   // SDIO_D2
palSetPadMode(GPIOC, 11, PAL_MODE_ALTERNATE(12) );    // SDIO_D3
palSetPadMode(GPIOC, 12, PAL_MODE_ALTERNATE(12) );  // SDIO_CK
palSetPadMode(GPIOD, 2, PAL_MODE_ALTERNATE(12) );    // SDIO_CMD
sdcStart(&SDCD1, NULL);

chiVelle
Posts: 21
Joined: Sun Aug 25, 2013 4:16 pm

Re: STM32F4DIS-BB anyone? at least SD card...

Postby chiVelle » Wed Dec 04, 2013 6:40 pm

Never mind on the previous post, bitwise OR on the GPIO pins with the appropriate STM32-specific I/O mode flags did the trick.

jafrey
Posts: 33
Joined: Tue Nov 05, 2013 12:15 am

Re: STM32F4DIS-BB anyone? at least SD card...

Postby jafrey » Wed Dec 04, 2013 11:54 pm

chiVelle wrote:Never mind on the previous post, bitwise OR on the GPIO pins with the appropriate STM32-specific I/O mode flags did the trick.


Could you post your code? I have this same setup and would like to get the SD card working.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 4 guests